public IActionResult ImpiantoFullInfo(int ipt_Id, int clt_Id) { DetailsViewModel model = new DetailsViewModel(); model.clt = _data.GetClient(clt_Id); model.imp = _data.GetImpiantoById(ipt_Id); if (_data.GetCogeneratoreByImpianto(ipt_Id) != null) { model.cogeneratori = _data.GetCogeneratoreByImpianto(ipt_Id).ToList(); } if (_data.GetVascheByImpianto(ipt_Id) != null) { model.vasche = _data.GetVascheByImpianto(ipt_Id).ToList(); foreach (var v in model.vasche) { if (_data.GetAgitatoriByVasche(v.vsc_Id) != null) { model.agitatori.AddRange(_data.GetAgitatoriByVasche(v.vsc_Id).ToList()); } if (_data.GetSensoriByVasche(v.vsc_Id) != null) { model.sensori.AddRange(_data.GetSensoriByVasche(v.vsc_Id).ToList()); } } } if (_data.GetGenericoByImpianto(ipt_Id) != null) { model.componentiGenerici.AddRange(_data.GetGenericoByImpianto(ipt_Id).ToList()); } return(View(model)); }//funzione che torna tutti i dati ed i controlli riguardo l'impianto