diff --git a/Controllers/DatiAziendaController.cs b/Controllers/DatiAziendaController.cs index 21887ad..ebffa5f 100644 --- a/Controllers/DatiAziendaController.cs +++ b/Controllers/DatiAziendaController.cs @@ -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 {