salvataggio immagine su server

This commit is contained in:
Marco Audiffredi 2024-08-06 09:32:22 +02:00
parent 6268bcaa6e
commit 4d57ac9529

View File

@ -146,7 +146,31 @@ namespace VirtualTask.Controllers
if (response.IsSuccessStatusCode)
{
return RedirectToAction("Index");
//prima di andare alla pagina devo chiamare il metodo per
//salvare il file in locale in modo che sia visibile sul web dall'app
//C:\ZAPIPOLO\loghi
//https://api.poloinformatico.it:9000/api/Polo/datiazienda/saveFile?azienda=AZI02&tecnico=aaaaa%20%20%20%20%20%20%20%20%20%20&pathSrv=C%3A%5CZAPIPOLO%5Cloghi'
apiUrl = helper.GetStringValue("apiUrl");
urlBase = apiUrl + "datiazienda/savefile";
urlBase = urlBase + "?azienda=" + model.azienda;
urlBase = urlBase + "&tecnico=" + model.tecnico;
//urlBase = urlBase + "&pathSrv=" + "C:\\ZAPIPOLO\\loghi";
urlBase = urlBase + "&pathSrv=" + _pathLoghi;
baseAddress = new Uri(urlBase);
client = new HttpClient();
client.BaseAddress = baseAddress;
HttpResponseMessage response2 = client.GetAsync(baseAddress).Result;
if (response2.IsSuccessStatusCode)
{
return RedirectToAction("Index");
}
else
{
errMes = response.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
else
{
@ -249,7 +273,33 @@ namespace VirtualTask.Controllers
if (response.IsSuccessStatusCode)
{
return RedirectToAction("Index");
//prima di andare alla pagina devo chiamare il metodo per
//salvare il file in locale in modo che sia visibile sul web dall'app
//C:\ZAPIPOLO\loghi
//https://api.poloinformatico.it:9000/api/Polo/datiazienda/saveFile?azienda=AZI02&tecnico=aaaaa%20%20%20%20%20%20%20%20%20%20&pathSrv=C%3A%5CZAPIPOLO%5Cloghi'
apiUrl = helper.GetStringValue("apiUrl");
urlBase = apiUrl + "datiazienda/savefile";
urlBase = urlBase + "?azienda=" + model.azienda;
urlBase = urlBase + "&tecnico=" + model.tecnico.Trim();
//urlBase = urlBase + "&pathSrv=" + "C:\\ZAPIPOLO\\loghi";
urlBase = urlBase + "&pathSrv=" + _pathLoghi;
baseAddress = new Uri(urlBase);
client = new HttpClient();
client.BaseAddress = baseAddress;
data = JsonConvert.SerializeObject(model);
content = new StringContent(data, Encoding.UTF8, "application/json");
HttpResponseMessage response2 = client.PostAsync(baseAddress, content).Result;
if (response2.IsSuccessStatusCode)
{
return RedirectToAction("Index");
}
else
{
errMes = response2.Content.ReadAsStringAsync().Result;
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
else
{