public bool editAirplane(int id, AdminAirplane inAir) { if (id == 0) { return(false); } else { return(true); } }
public bool insertAirplane(AdminAirplane inAir) { if (inAir.Name == "") { return(false); } else { return(true); } }
public ActionResult NewAirplane(AdminAirplane inAir) { if (ModelState.IsValid) { if (_AdminBll.insertAirplane(inAir)) { return(RedirectToAction("ListAirplane")); } } return(RedirectToAction("Error")); }
public ActionResult EditAirplane(int id, AdminAirplane inAir) { if (ModelState.IsValid) { if (_AdminBll.editAirplane(id, inAir)) { return(RedirectToAction("ListAirplane")); } } return(RedirectToAction("Error")); }
public List <AdminAirplane> listAirplanes() { var plane = new AdminAirplane() { ID = 1, Name = "Boeing737", Seats = 500 }; var list = new List <AdminAirplane>(); list.Add(plane); return(list); }
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); } }
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); } }
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); } } }
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); } }
public bool editAirPlane(int id, AdminAirplane inAir) { return(_repository.editAirplane(id, inAir)); }
public bool insertAirplane(AdminAirplane inAir) { return(_repository.insertAirplane(inAir)); }