Exemple #1
0
 public ActionResult AddStopStationForFlight(AirStopOver aso)
 {
     if (ModelState.IsValid)
     {
         if (aso.ThoiGianDung == null)
         {
             ModelState.AddModelError("", "Chọn thời gian dừng");
             return(View("AddStopStationForFlight", aso));
         }
         if (aso.ThoiGianDung > 20 || aso.ThoiGianDung < 10)
         {
             ModelState.AddModelError("", "Thời gian dừng phải từ khoảng 10 -20 phút");
             return(View("AddStopStationForFlight", aso));
         }
         else if (!CheckIfMoreThan2AirStop((int)aso.FlightId))
         {
             ModelState.AddModelError("", "chuyến bay này đã có tối đa 2 trạm dừng chân");
             return(View("AddStopStationForFlight", aso));
         }
         else
         {
             db.Entry(aso).State = System.Data.Entity.EntityState.Added;
             db.SaveChanges();
             return(RedirectToAction("FlightDetails", new { id = aso.FlightId }));
         }
     }
     else
     {
         return(View("AddStopStationForFlight", aso));
     }
 }
Exemple #2
0
        public ActionResult AddStopStationForFlight(int id)
        {
            Session["apList"] = new SelectList(AirportSelectListItem(), "value", "text");
            AirStopOver aso = new AirStopOver();

            aso.FlightId = id;
            return(View("AddStopStationForFlight", aso));
        }