public void UpdateFlightClassDetail(FlightClassDetail flightClassDetail) { using (OnlineFlightTicketBookingDBContext FlightDBContext = new OnlineFlightTicketBookingDBContext()) { FlightDBContext.Entry(flightClassDetail).State = EntityState.Modified; FlightDBContext.SaveChanges(); } }
public void AddFlightClassDetail(FlightClassDetail flightClassDetail) { using (OnlineFlightTicketBookingDBContext FlightDBContext = new OnlineFlightTicketBookingDBContext()) { FlightDBContext.FlightClassDetails.Add(flightClassDetail); FlightDBContext.SaveChanges(); } }
public void DeleteFlightClassDetail(int id) { using (OnlineFlightTicketBookingDBContext FlightDBContext = new OnlineFlightTicketBookingDBContext()) { //Flight flight = GetFlight(id); FlightClassDetail flightClassDetail = FlightDBContext.FlightClassDetails.Find(id); FlightDBContext.FlightClassDetails.Remove(flightClassDetail); // FlightDBContext.Entry(flight).State = EntityState.Deleted; FlightDBContext.SaveChanges(); } }
public ActionResult EditFlightClassDetail(int id) { List <FlightClass> flightClass = flightClassBL.GetFlightClasses(); ViewBag.flightClass = new SelectList(flightClass, "FlightClassId", "FlightClassName"); FlightClassDetailViewModel flightClassDetailViewModel; FlightClassDetail flightClassDetails = flightClassDetailBL.GetFlightClassDetail(id); var mapAccount = new MapperConfiguration(cfg => { cfg.CreateMap <FlightClassDetail, FlightClassDetailViewModel>(); }); IMapper mapper = mapAccount.CreateMapper(); flightClassDetailViewModel = mapper.Map <FlightClassDetail, FlightClassDetailViewModel>(flightClassDetails); return(View(flightClassDetailViewModel)); }
public ActionResult UpdateFlightClassDetail(FlightClassDetailViewModel flightClassDetailViewModel) { FlightClassDetail flightClassDetail = null; if (ModelState.IsValid) { var mapAccount = new MapperConfiguration(cfg => { cfg.CreateMap <FlightClassDetailViewModel, FlightClassDetail>(); }); IMapper mapper = mapAccount.CreateMapper(); flightClassDetail = mapper.Map <FlightClassDetailViewModel, FlightClassDetail>(flightClassDetailViewModel); flightClassDetailBL.UpdateFlightClassDetail(flightClassDetail); return(RedirectToAction("DisplayFlightClassDetail")); } else { ModelState.AddModelError("", "Invalid Values"); } return(View(flightClassDetail)); }
public void UpdateFlightClassDetail(FlightClassDetail flightClassDetail) { flightClassDetailRepository.UpdateFlightClassDetail(flightClassDetail); }
public void AddFlightClassDetail(FlightClassDetail flightClassDetail) { flightClassDetailRepository.AddFlightClassDetail(flightClassDetail); }
public ActionResult DeleteFlightClassDetail(FlightClassDetail flightClassDetail) { flightClassDetailBL.DeleteFlightClassDetail(flightClassDetail.FlightClassDetailId); return(RedirectToAction("DisplayFlightClassDetail")); }
public ActionResult DeleteFlightClassDetail(int id) { FlightClassDetail flightClassDetails = flightClassDetailBL.GetFlightClassDetail(id); return(View(flightClassDetails)); }