public ActionResult Create() { if (Session["hostID"] == null) { RedirectToAction("Login", "Index"); } MultipleCreatePage model = new MultipleCreatePage(); List <Lot> lists = new LotDAO().ListLot(); model.ListLot = lists; return(View(model)); }
public ActionResult Create(MultipleCreatePage model) { try { // TODO: Add insert logic here if (ModelState.IsValid) { LotHostDAO dao = new LotHostDAO(); int count = dao.CountLotHot(Session["hostID"].ToString()); string LoHID = Session["hostID"].ToString().ToUpper() + "-" + count; int result = dao.Create(LoHID, Session["hostID"].ToString(), model.LotHostInsert.LotID); if (result > 0) { Session["SUCCESS"] = "Create Parking Lot " + LoHID + " Success!\n Waiting For Administration Accept!"; return(RedirectToAction("Create", "CreateParkingLot", new { area = "Host" })); } else { ModelState.AddModelError("", "Create new parking lot is false!"); } } Session["SUCCESS"] = null; List <Lot> lists = new LotDAO().ListLot(); model.ListLot = lists; return(View(model)); } catch { Session["SUCCESS"] = null; List <Lot> lists = new LotDAO().ListLot(); model.ListLot = lists; model.CreateErrorMessage = "You must select range of parking lot!"; return(View(model)); } }