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();
     }
 }
示例#4
0
        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));
        }
示例#5
0
        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));
        }
示例#6
0
 public void UpdateFlightClassDetail(FlightClassDetail flightClassDetail)
 {
     flightClassDetailRepository.UpdateFlightClassDetail(flightClassDetail);
 }
示例#7
0
 public void AddFlightClassDetail(FlightClassDetail flightClassDetail)
 {
     flightClassDetailRepository.AddFlightClassDetail(flightClassDetail);
 }
示例#8
0
 public ActionResult DeleteFlightClassDetail(FlightClassDetail flightClassDetail)
 {
     flightClassDetailBL.DeleteFlightClassDetail(flightClassDetail.FlightClassDetailId);
     return(RedirectToAction("DisplayFlightClassDetail"));
 }
示例#9
0
        public ActionResult DeleteFlightClassDetail(int id)
        {
            FlightClassDetail flightClassDetails = flightClassDetailBL.GetFlightClassDetail(id);

            return(View(flightClassDetails));
        }