// GET: LampSetup /// <summary> /// Startpunkt für den LampSetup-View, UserSession-Abfrage, Lampenliste von der BL abfragen, Model initialisieren und an View senden. /// </summary> /// <returns>LampSetupModel</returns> public ActionResult Index() { try { //User-Session-Informationen abrufen. UserSession us = (UserSession)Session["UserSession"]; //Model initialisieren. LampSetupModel lsm = new LampSetupModel(); //Model-Lampenliste initialisieren. lsm.Lamplist = new List<fn_show_lamps_Result>(); //Temporäre Sortierliste Inhalt zuweisen. List<fn_show_lamps_Result> slrsort = HicsBL.DbAccess.GetAllLamps(us.name, us.pw); //Liste invertieren. for (int i = slrsort.Count - 1; i >= 0; i--) { lsm.Lamplist.Add(slrsort[i]); } return View(lsm); } catch (Exception) { return RedirectToAction("Login", "Login"); } }
public ActionResult AddLamp(LampSetupModel lsm) { try { //User-Session-Informationen abrufen. UserSession us = (UserSession)Session["UserSession"]; //Lampe über BL erstellen. HicsBL.DbAccess.addLamp(us.name, us.pw, lsm.Id, lsm.Description); //View neu aufbauen. return RedirectToAction("index"); } catch (Exception) { return RedirectToAction("Login", "Login"); } }