// GET: Sauna/Details/5 public ActionResult Details(int?id) { SaunaViewModel model = new SaunaViewModel(); AlytaloEntities entities = new AlytaloEntities(); try { Saunat taloSauna = db.Saunat.Find(id); if (taloSauna == null) { return(HttpNotFound()); } Saunat saunadetail = entities.Saunat.Find(taloSauna.SaunaId); SaunaViewModel sauna = new SaunaViewModel(); sauna.SaunaId = saunadetail.SaunaId; sauna.SaunaNimi = saunadetail.SaunaNimi; sauna.SaunaTavoiteLampotila = saunadetail.SaunaTavoiteLampotila; sauna.SaunaNykyLampotila = saunadetail.SaunaNykyLampotila; sauna.SaunanTila = saunadetail.SaunanTila; model = sauna; } finally { entities.Dispose(); } return(View(model)); }
// GET: Talo public ActionResult Index() { List <TaloViewModel> model = new List <TaloViewModel>(); AlytaloEntities entities = new AlytaloEntities(); try { List <Talot> lammot = entities.Talot.ToList(); foreach (Talot talolampo in lammot) { TaloViewModel lampo = new TaloViewModel(); lampo.TaloId = talolampo.TaloId; lampo.TaloNimi = talolampo.TaloNimi; lampo.TaloTavoiteLampotila = talolampo.TaloTavoiteLampotila; lampo.TaloNykyLampotila = talolampo.TaloNykyLampotila; lampo.LampoOff = talolampo.LampoOff; lampo.LampoOn = talolampo.LampoOn; model.Add(lampo); } } finally { entities.Dispose(); } return(View(model)); }
// GET: Sauna public ActionResult Index() { List <SaunaViewModel> model = new List <SaunaViewModel>(); AlytaloEntities entities = new AlytaloEntities(); try { List <Saunat> saunat = entities.Saunat.ToList(); foreach (Saunat talosauna in saunat) { SaunaViewModel sauna = new SaunaViewModel(); sauna.SaunaId = talosauna.SaunaId; sauna.SaunaNimi = talosauna.SaunaNimi; sauna.SaunanTila = talosauna.SaunanTila; sauna.SaunaNykyLampotila = talosauna.SaunaNykyLampotila; sauna.SaunaTavoiteLampotila = talosauna.SaunaTavoiteLampotila; model.Add(sauna); } } finally { entities.Dispose(); } return(View(model)); }
// GET: Valo public ActionResult Index() { List <ValoViewModel> model = new List <ValoViewModel>(); AlytaloEntities entities = new AlytaloEntities(); try { List <Valot> valot = entities.Valot.ToList(); foreach (Valot talovalo in valot) { ValoViewModel valo = new ValoViewModel(); valo.ValoId = talovalo.ValoId; valo.Huone = talovalo.Huone; valo.ValoOff = talovalo.ValoOff; valo.ValoOn33 = talovalo.ValoOn33; valo.ValoOn66 = talovalo.ValoOn66; valo.ValoOn100 = talovalo.ValoOn100; model.Add(valo); } } finally { entities.Dispose(); } return(View(model)); }
protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }