600 lines
23 KiB
C#
600 lines
23 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
using Newtonsoft.Json;
|
|
using SoftwayWeb.Models;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Reflection;
|
|
using System.Runtime.Intrinsics.Arm;
|
|
using System.Text;
|
|
using X.PagedList;
|
|
|
|
namespace SoftwayWeb.Controllers
|
|
{
|
|
public class GiriController : Controller
|
|
{
|
|
string apiUrl = string.Empty;
|
|
string urlBase = string.Empty;
|
|
string token = string.Empty;
|
|
string errMes = string.Empty;
|
|
string messAcc = string.Empty;
|
|
string messNew = string.Empty;
|
|
private readonly IConfiguration _configuration;
|
|
private readonly IConfiguration _mess1;
|
|
private readonly IConfiguration _mess2;
|
|
HttpClient client;
|
|
SessionHelper helper;
|
|
|
|
public GiriController(IConfiguration configuration, IConfiguration mess1, IConfiguration mess2)
|
|
{
|
|
_configuration = configuration;
|
|
_mess1 = mess1;
|
|
_mess2 = mess2;
|
|
client = new HttpClient();
|
|
var key = _configuration["ApplicationInsights:rootUrlApi"];
|
|
var messA = _mess1["ApplicationInsights:messDestiAccodo"];
|
|
var messN = _mess2["ApplicationInsights:messDestiNew"];
|
|
apiUrl = key;
|
|
messAcc = messA;
|
|
messNew = messN;
|
|
}
|
|
|
|
public IActionResult Index(string? codAutista, string? codMezzo, DateTime data, bool aperto = true, int? page = 1)
|
|
{
|
|
helper = new SessionHelper(this);
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
urlBase = apiUrl + "Giri/listaGiri?aperto="+ aperto;
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
List<GiriConsegnaView> modelList = new List<GiriConsegnaView>();
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string dato = response.Content.ReadAsStringAsync().Result;
|
|
modelList = JsonConvert.DeserializeObject<List<GiriConsegnaView>>(dato);
|
|
|
|
ViewBag.CodAutista = getAutisti();
|
|
|
|
if (!string.IsNullOrEmpty(codAutista))
|
|
{
|
|
modelList = modelList.Where(x => x.CodAutista.Contains(codAutista)).ToList();
|
|
|
|
ViewData["CurrentFilter"] = codAutista;
|
|
|
|
ViewBag.Autista = codAutista;
|
|
}
|
|
else
|
|
{
|
|
ViewData["CurrentFilter"] = null;
|
|
}
|
|
|
|
ViewBag.CodMezzo = getMezzi();
|
|
|
|
if (!string.IsNullOrEmpty(codMezzo))
|
|
{
|
|
modelList = modelList.Where(x => x.CodMezzo.Contains(codMezzo)).ToList();
|
|
ViewData["CurrentFilter"] = codMezzo;
|
|
}
|
|
else
|
|
{
|
|
ViewData["CurrentFilter"] = null;
|
|
}
|
|
|
|
if (data.Date != DateTime.MinValue)
|
|
{
|
|
modelList = modelList.Where(x => x.DataGiro.GetValueOrDefault().Date == data.Date).ToList();
|
|
}
|
|
|
|
if (page != null && page < 1)
|
|
{
|
|
page = 1;
|
|
}
|
|
|
|
ViewData["Aperto"] = aperto;
|
|
|
|
var pageSize = 10;
|
|
|
|
var shortList = modelList.ToPagedList(page ?? 1, pageSize);
|
|
return View(shortList);
|
|
}
|
|
else
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
}
|
|
|
|
public IActionResult Create(bool sel)
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
List<GiriConsegnaDaCreare> modelList = new List<GiriConsegnaDaCreare>();
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/listaGiriDaCreare";
|
|
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string data = response.Content.ReadAsStringAsync().Result;
|
|
modelList = JsonConvert.DeserializeObject<List<GiriConsegnaDaCreare>>(data);
|
|
}
|
|
|
|
foreach(GiriConsegnaDaCreare giro in modelList)
|
|
{
|
|
giro.IsSelected= sel;
|
|
}
|
|
|
|
return View(modelList);
|
|
}
|
|
|
|
[HttpPost]
|
|
public IActionResult PostIndex(IList<GiriConsegnaDaCreare> lst)
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
foreach (GiriConsegnaDaCreare g in lst)
|
|
{
|
|
if(g.IsSelected==true)
|
|
{
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/addGiro2";
|
|
|
|
GiriConsegnaView gcv=new GiriConsegnaView();
|
|
gcv.CodAutista = g.CodAutista;
|
|
gcv.DataGiro=g.DataGiro;
|
|
gcv.CodMezzo = g.CodMezzo;
|
|
gcv.DataChiusura = DateTime.MinValue;
|
|
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
string data = JsonConvert.SerializeObject(gcv);
|
|
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
|
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
}
|
|
}
|
|
return RedirectToAction("Index", "Giri");
|
|
}
|
|
|
|
public IActionResult Bancali(string id, bool aperto = true)
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/listaGiri?aperto=" + aperto;
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
List<GiriConsegnaView> modelList = new List<GiriConsegnaView>();
|
|
GiriConsegnaView model = new GiriConsegnaView();
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string data = response.Content.ReadAsStringAsync().Result;
|
|
modelList = JsonConvert.DeserializeObject<List<GiriConsegnaView>>(data);
|
|
model = modelList.Where(x => x.SerialeGiro.Equals(id)).First();
|
|
}
|
|
else
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
|
|
return View(model);
|
|
}
|
|
|
|
[HttpPost]
|
|
public IActionResult Bancali(GiriConsegnaView model)
|
|
{
|
|
if (model.BancaliCaricati == null)
|
|
{
|
|
return View(model);
|
|
}
|
|
SessionHelper helper = new SessionHelper(this);
|
|
helper.ClearFormatedKey("errMsg");
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/modGiro";
|
|
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
string data = JsonConvert.SerializeObject(model);
|
|
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
|
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
return RedirectToAction("Index", "Giri");
|
|
}
|
|
else
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult ModificaTutteDestinazioni(string id, string? codAutista, string? nomeAutista, string? codMezzo, string? nomeMezzo, DateTime dataGiroCons/*, int? page = 1*/)
|
|
{
|
|
helper = new SessionHelper(this);
|
|
helper.ClearFormatedKey("errMsg");
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
ViewBag.CodAutista = codAutista;
|
|
ViewBag.NomeAutista = nomeAutista;
|
|
ViewBag.CodMezzo = codMezzo;
|
|
ViewBag.NomeMezzo = nomeMezzo;
|
|
ViewBag.DataGiroCons = dataGiroCons;
|
|
ViewBag.SerialeGiro = id;
|
|
|
|
|
|
string dataGiroString = dataGiroCons.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
|
|
|
|
urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
|
|
urlBase = urlBase + "?autista=" + codAutista + "&dataGiro=" + dataGiroString + "&mezzo=" + codMezzo;
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
List<Destinazioni_Out> modelList = new List<Destinazioni_Out>();
|
|
|
|
List<SelectListItem> autisti = new List<SelectListItem>();
|
|
autisti = getAutisti();
|
|
ViewBag.Autisti = autisti;
|
|
|
|
List<SelectListItem> mezzi = new List<SelectListItem>();
|
|
mezzi = getMezzi();
|
|
ViewBag.Mezzi = mezzi;
|
|
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string dato = response.Content.ReadAsStringAsync().Result;
|
|
modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato);
|
|
modelList = modelList.Where(x => x.serialeGiro!=null && x.serialeGiro.Equals(id.TrimEnd())).OrderBy(x => x.Seq).ThenBy(x => x.Committente).ToList();
|
|
|
|
return View(modelList);
|
|
}
|
|
else
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
public IActionResult ModificaTutteDestinazioniStep1(string SerialeGiro, string? CodAutista, string? NomeAutista, string? CodMezzo, string? NomeMezzo, DateTime DataGiroCons,string CodAutistaOld,string CodMezzoOld)
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
helper.ClearFormatedKey("errMsg");
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
ViewBag.CodAutista = CodAutista;
|
|
ViewBag.NomeAutista = NomeAutista;
|
|
ViewBag.CodMezzo = CodMezzo;
|
|
ViewBag.NomeMezzo = NomeMezzo;
|
|
ViewBag.DataGiroCons = DataGiroCons;
|
|
ViewBag.SerialeGiro = SerialeGiro;
|
|
|
|
ViewBag.CodAutistaOld = CodAutistaOld;
|
|
ViewBag.CodMezzoOld = CodMezzoOld;
|
|
|
|
|
|
|
|
string dataGi = string.Empty;
|
|
dataGi = DataGiroCons.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
|
|
//urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzoWeb";
|
|
urlBase = apiUrl + "Giri/listaGiriTestataByAutistaDataMezzo";
|
|
urlBase = urlBase + "?autista=" + CodAutista + "&dataGiro=" + dataGi + "&mezzo=" + CodMezzo;
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
List<Destinazioni_Out> modelList1 = new List<Destinazioni_Out>();
|
|
List<Pigircon> modelList2 = new List<Pigircon>();
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string dato = response.Content.ReadAsStringAsync().Result;
|
|
modelList2 = JsonConvert.DeserializeObject<List<Pigircon>>(dato);
|
|
var presenti = modelList2.OrderByDescending(t => t.Pisergir);
|
|
|
|
string mex = string.Empty;
|
|
//var nomeA = item.Autista;
|
|
//var nomeM = item.DescAutomezzo;
|
|
|
|
if (presenti != null && presenti.Count() > 0)
|
|
{
|
|
//giro già esistente.. accodo
|
|
mex = messAcc;
|
|
ViewBag.TipoOperazione = "M";
|
|
string serialeGiroDestinazione = string.Empty;
|
|
foreach(Pigircon dd in presenti)
|
|
{
|
|
serialeGiroDestinazione = dd.Pisergir;
|
|
}
|
|
ViewBag.SerialeGiroDestinazione = serialeGiroDestinazione;
|
|
}
|
|
else
|
|
{
|
|
// giro non esistente.. ne creo uno nuovo
|
|
mex = messNew;
|
|
ViewBag.TipoOperazione = "N";
|
|
}
|
|
ViewBag.Messaggio = mex;
|
|
|
|
//qui devo ricaricare la lista delle destinazioni che sto cambiando passando
|
|
//mezzo e autista OLD
|
|
urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzoWeb";
|
|
urlBase = urlBase + "?autista=" + CodAutistaOld + "&dataGiro=" + dataGi + "&mezzo=" + CodMezzoOld;
|
|
baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
response = client.GetAsync(baseAddress).Result;
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string dato2 = response.Content.ReadAsStringAsync().Result;
|
|
modelList1 = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato2);
|
|
}
|
|
else
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
errMes = response.Content.ReadAsStringAsync().Result;
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
return View(modelList1);
|
|
}
|
|
|
|
[HttpPost]
|
|
public IActionResult ModificaTutteDestinazioniPost(List<Destinazioni_Out> modelList, string? CodAutista, string? CodMezzo, DateTime DataGiroCons,string SerialeGiro,string TipoOperazione,string SerialeGiroDestinazione)
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
helper.ClearFormatedKey("errMsg");
|
|
token = helper.GetStringValue("tok");
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
{
|
|
return RedirectToAction("Login", "Login");
|
|
}
|
|
|
|
string dataGi = string.Empty;
|
|
dataGi = DataGiroCons.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
|
|
foreach (var model in modelList)
|
|
{
|
|
Modgir mg = new Modgir();
|
|
|
|
mg.Piserial = model.Brserial;
|
|
mg.Pidata = DataGiroCons;
|
|
mg.Picommit = model.CodCommittente;
|
|
mg.Pidesdiv = model.CodSede;
|
|
mg.Pitarga = CodMezzo;
|
|
mg.Piautist = CodAutista;
|
|
mg.Pitiprec = TipoOperazione;
|
|
if (!string.IsNullOrEmpty(TipoOperazione) && TipoOperazione.Equals("M"))
|
|
{
|
|
mg.Pisergirold = SerialeGiro;
|
|
mg.Pisergir = SerialeGiroDestinazione;
|
|
}
|
|
else
|
|
{
|
|
mg.Pisergirold = SerialeGiro;
|
|
}
|
|
|
|
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "ModificaGiro/addModgir";
|
|
Uri baseAddress = new Uri(urlBase);
|
|
baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
string data = JsonConvert.SerializeObject(mg);
|
|
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
|
HttpResponseMessage response2 = client.PostAsync(baseAddress, content).Result;
|
|
|
|
if (!response2.IsSuccessStatusCode)
|
|
{
|
|
errMes = helper.getErrMsgFromResponse(response2);
|
|
helper.SetStringValue("errMsg", errMes);
|
|
return RedirectToAction("Error");
|
|
}
|
|
}
|
|
|
|
return RedirectToAction("Index", "Giri");
|
|
}
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
string e = helper.GetStringValue("errMsg");
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier, ErrMsg = e });
|
|
}
|
|
|
|
#region METODI PRIVATI
|
|
|
|
private List<SelectListItem> getAutisti()
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
token = helper.GetStringValue("tok");
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/listaAutisti";
|
|
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
List<SelectListItem> selectItems = new List<SelectListItem>();
|
|
List<Personale> modelList = new List<Personale>();
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string data = response.Content.ReadAsStringAsync().Result;
|
|
modelList = JsonConvert.DeserializeObject<List<Personale>>(data);
|
|
|
|
//per gestire primo elemento tendina (deve essere vuoto)
|
|
SelectListItem listItemFirt = new SelectListItem();
|
|
|
|
listItemFirt.Value = string.Empty;
|
|
listItemFirt.Text = " - Autista";
|
|
selectItems.Add(listItemFirt);
|
|
|
|
foreach (var role in modelList)
|
|
{
|
|
SelectListItem listItem = new SelectListItem();
|
|
//string s = role.Catcodice + " - " + role.Catnome;
|
|
string s = role.Catnome + " - " + role.Catcodice; // 25/07/2024 invertito nome autista con codice autista
|
|
listItem.Value = role.Catcodice;
|
|
listItem.Text = s;
|
|
selectItems.Add(listItem);
|
|
}
|
|
}
|
|
|
|
return selectItems;
|
|
}
|
|
|
|
private List<SelectListItem> getMezzi()
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
token = helper.GetStringValue("tok");
|
|
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/listaAutomezzi";
|
|
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
List<SelectListItem> selectItems = new List<SelectListItem>();
|
|
List<Automezzi> listMezzi = new List<Automezzi>();
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string data = response.Content.ReadAsStringAsync().Result;
|
|
listMezzi = JsonConvert.DeserializeObject<List<Automezzi>>(data);
|
|
|
|
listMezzi = listMezzi.OrderBy(x => x.CauTarga).ToList();
|
|
|
|
//per gestire primo elemento tendina (deve essere vuoto)
|
|
SelectListItem listItemFirt = new SelectListItem();
|
|
|
|
listItemFirt.Value = string.Empty;
|
|
listItemFirt.Text = " - Automezzo";
|
|
selectItems.Add(listItemFirt);
|
|
|
|
foreach (var mezzo in listMezzi)
|
|
{
|
|
SelectListItem listItem = new SelectListItem();
|
|
List<SelectListItem> listItemOrderby = new List<SelectListItem>();
|
|
string s = mezzo.CauTarga + " - " + mezzo.CauDesc;
|
|
listItem.Value = mezzo.CauTarga;
|
|
listItem.Text = s;
|
|
|
|
selectItems.Add(listItem);
|
|
}
|
|
}
|
|
|
|
return selectItems;
|
|
|
|
}
|
|
|
|
private List<GiriConsegnaDaCreare> getNuoviGiri()
|
|
{
|
|
SessionHelper helper = new SessionHelper(this);
|
|
List<GiriConsegnaDaCreare> modelList = new List<GiriConsegnaDaCreare> ();
|
|
apiUrl = helper.GetStringValue("apiUrl");
|
|
urlBase = apiUrl + "Giri/listaGiriDaCreare";
|
|
|
|
Uri baseAddress = new Uri(urlBase);
|
|
client = new HttpClient();
|
|
client.BaseAddress = baseAddress;
|
|
|
|
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
string data = response.Content.ReadAsStringAsync().Result;
|
|
modelList = JsonConvert.DeserializeObject<List<GiriConsegnaDaCreare>>(data);
|
|
}
|
|
return modelList;
|
|
}
|
|
|
|
#endregion METODI PRIVATI
|
|
}
|
|
}
|