示例#1
0
 public bool editAirplane(int id, AdminAirplane inAir)
 {
     if (id == 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#2
0
 public bool insertAirplane(AdminAirplane inAir)
 {
     if (inAir.Name == "")
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#3
0
 public ActionResult NewAirplane(AdminAirplane inAir)
 {
     if (ModelState.IsValid)
     {
         if (_AdminBll.insertAirplane(inAir))
         {
             return(RedirectToAction("ListAirplane"));
         }
     }
     return(RedirectToAction("Error"));
 }
示例#4
0
 public ActionResult EditAirplane(int id, AdminAirplane inAir)
 {
     if (ModelState.IsValid)
     {
         if (_AdminBll.editAirplane(id, inAir))
         {
             return(RedirectToAction("ListAirplane"));
         }
     }
     return(RedirectToAction("Error"));
 }
示例#5
0
        public List <AdminAirplane> listAirplanes()
        {
            var plane = new AdminAirplane()
            {
                ID    = 1,
                Name  = "Boeing737",
                Seats = 500
            };
            var list = new List <AdminAirplane>();

            list.Add(plane);
            return(list);
        }
示例#6
0
        public bool editAirplane(int id, AdminAirplane inAir)
        {
            var db = new WAPPContext();

            try
            {
                var editAir = db.Airplanes.Find(id);
                editAir.Name  = inAir.Name;
                editAir.Seats = inAir.Seats;
                db.SaveChanges();
                return(true);
            }
            catch (Exception exception)
            {
                LogException(exception);
                return(false);
            }
        }
示例#7
0
 public AdminAirplane oneAirplane(int id)
 {
     if (id == 0)
     {
         var airplane = new AdminAirplane();
         airplane.ID = 0;
         return(airplane);
     }
     else
     {
         var airplane = new AdminAirplane()
         {
             ID    = 1,
             Name  = "Boeing737",
             Seats = 500
         };
         return(airplane);
     }
 }
示例#8
0
 public bool insertAirplane(AdminAirplane inAir)
 {
     using (var db = new WAPPContext())
     {
         try
         {
             var newAir = new Airplane();
             newAir.Name  = inAir.Name;
             newAir.Seats = inAir.Seats;
             db.Airplanes.Add(newAir);
             db.SaveChanges();
             return(true);
         }
         catch (Exception exception)
         {
             LogException(exception);
             return(false);
         }
     }
 }
示例#9
0
        public AdminAirplane oneAirplane(int id)
        {
            var db = new WAPPContext();
            var e  = db.Airplanes.Find(id);

            if (e == null)
            {
                return(null);
            }
            else
            {
                var one = new AdminAirplane()
                {
                    ID    = e.ID,
                    Name  = e.Name,
                    Seats = e.Seats
                };

                return(one);
            }
        }
示例#10
0
 public bool editAirPlane(int id, AdminAirplane inAir)
 {
     return(_repository.editAirplane(id, inAir));
 }
示例#11
0
 public bool insertAirplane(AdminAirplane inAir)
 {
     return(_repository.insertAirplane(inAir));
 }