示例#1
0
 // ================ ROUTE ==================
 // ROUTE's VIEW
 public ActionResult Route()
 {
     if (IsLoggedIn())
     {
         return(View(RouteDAO.GetRouteList()));
     }
     return(RedirectToAction("Index"));
 }
 // FLIGHT EDIT'S VIEW
 public ActionResult FlightEdit(string id)
 {
     if (IsLoggedIn())
     {
         var f = FlightDAO.GetFlight(id);
         if (f != null)
         {
             ViewBag.RouteData = RouteDAO.GetRouteList();
             return(View(f));
         }
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult FlightEdit(Flight updateF)
 {
     ModelState.Remove("AvailSeatsF");
     ModelState.Remove("AvailSeatsE");
     ModelState.Remove("AvailSeatsB");
     ModelState.Remove("FlightTime");
     if (ModelState.IsValid)
     {
         var editResult = FlightDAO.UpdateFlight(updateF);
         if (editResult == "ok")
         {
             return(RedirectToAction("Flight"));
         }
         ModelState.AddModelError("", editResult);
     }
     ViewBag.RouteData = RouteDAO.GetRouteList();
     return(View(updateF));
 }