public ActionResult FlightDeletedone(string id) { FlightsDetail flightsDetail = db.FlightsDetails.Find(id); db.FlightsDetails.Remove(flightsDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult FlightEdit([Bind(Include = "FlightId,LaunchDate,Origin,Destination,DeptTime,ArrivalTime,NoOfSeats,Fare")] FlightsDetail flightsDetail) { if (ModelState.IsValid) { db.Entry(flightsDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(flightsDetail)); }
// GET: FlightsDetails/Delete/5 public ActionResult FlightDelete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FlightsDetail flightsDetail = db.FlightsDetails.Find(id); if (flightsDetail == null) { return(HttpNotFound()); } return(View(flightsDetail)); }
public ActionResult FlightCreate([Bind(Include = "FlightId,LaunchDate,Origin,Destination,DeptTime,ArrivalTime,NoOfSeats,Fare")] FlightsDetail flightsDetail) { if (ModelState.IsValid) { if (flightsDetail.Origin == flightsDetail.Destination) { TempData["message"] = "Origin and Destination cannot be same"; return(View()); } else { db.FlightsDetails.Add(flightsDetail); db.SaveChanges(); return(RedirectToAction("FlightList")); } } return(View(flightsDetail)); }