//[HttpPost] public ActionResult BookHanger1() { ViewBag.L = l1; string pid = Request.Form["PlaneID"]; if (pid == "") { tblHanger h1 = DBOperations.getHanger(Session["hid"].ToString()); ViewBag.s = "Please select PlaneId to alloacte Hanger"; return(View("BookHanger", h1)); } else { tblPlaneAllocation PlaneAlloc = new tblPlaneAllocation(); PlaneAlloc.StartDate = DateTime.Parse(Session["sdate"].ToString()); PlaneAlloc.EndDate = DateTime.Parse(Session["edate"].ToString()); PlaneAlloc.HangerID = Session["hid"].ToString(); PlaneAlloc.PlaneID = pid; ViewBag.s = ""; ViewBag.msg = DBOperations.AllocatePlaneToHanger(PlaneAlloc); tblHanger h1 = DBOperations.getHanger(Session["hid"].ToString()); return(View("BookHanger", h1)); } }
// checks all the validations and get the available hangers between the entered dates public ActionResult AvailableHangers(tblPlaneAllocation pa) { if (ModelState.IsValid) { Session["sdate"] = DateTime.Parse(Request.Form["StartDate"]); Session["edate"] = DateTime.Parse(Request.Form["EndDate"]); if (DateTime.Parse(Request.Form["StartDate"]) < DateTime.Parse(Request.Form["EndDate"])) { List <sp_AvailableHangersDetails_Result> l = DBOperations.getAvailabeHangers(DateTime.Parse(Request.Form["StartDate"]), DateTime.Parse(Request.Form["EndDate"])); Session["avail"] = l; return(View(l)); } else { ViewBag.se = "Please Select proper dates to book"; return(View("AllotingPlane")); } } else { return(View("AllotingPlane")); } }