public ActionResult Create(AirlineFlighClassViewModel model) { bool check = _domesticProvider.CheckFlightCode(model.AirlineId, model.FlightClassCode); if (check == false) { try { _domesticProvider.AddFlightClass(model); /////// Return to View After Success AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), }; TempData["Message"] = "Successfully added"; return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } } TempData["Message"] = "Code Already exists"; return(RedirectToAction("Index")); }
public ActionResult Edit(AirlineFlighClassViewModel model) { // int airlineId = _domesticProvider.GetAirlineId(model.FlightClassId); model.AirlineId = model.HFAirlineId; // model.FlightClassId = id; bool check = true; check = _domesticProvider.CheckFlightCode(model.AirlineId, model.FlightClassCode); try { // TODO: Add update logic here _domesticProvider.UpdatFlightClasses(model); // TempData["Message"] = "Successfully updated"; return(RedirectToAction("Index")); } catch { return(View()); } //TempData["Message"] = "Code Already exists"; //return RedirectToAction("Index"); }
// // GET: /DomesticFlightClass/ public ActionResult Index() { AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { AirlineFlighClass = _domesticProvider.GetAllFlightClassesList().ToList().AsQueryable(), }; return(View(viewmodel)); }
public void UpdatFlightClasses(AirlineFlighClassViewModel modeltosave) { Air_DomesticFlightClasses comm = ent.Air_DomesticFlightClasses.Where(u => u.DomesticFlightClassId == modeltosave.FlightClassId).FirstOrDefault(); comm.DomesticFlightClassId = modeltosave.FlightClassId; comm.FlightClassCode = modeltosave.FlightClassCode; comm.FlightClassType = modeltosave.ClassType; ent.ApplyCurrentValues(comm.EntityKey.EntitySetName, comm); ent.SaveChanges(); ///// }
/////////// only Flight Class For domestic /////////////// public void AddDomesticAirlineFlightClass(AirlineFlighClassViewModel model) { AirlineFlightClasses datamodel = new AirlineFlightClasses { AirlineId = model.AirlineId, FlightClassId = model.FlightClassId, }; ent.AddToAirlineFlightClasses(datamodel); ent.SaveChanges(); }
public void AddFlightClass(AirlineFlighClassViewModel model) { Air_DomesticFlightClasses datamodel = new Air_DomesticFlightClasses { AirlineId = model.AirlineId, FlightClassCode = model.FlightClassCode, FlightClassType = model.ClassType }; ent.AddToAir_DomesticFlightClasses(datamodel); ent.SaveChanges(); }
// // GET: /DomesticFlightClass/Create public ActionResult Create() { AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), }; if (Request != null && Request.IsAjaxRequest()) { return(PartialView("Create", viewmodel)); } else { return(View(viewmodel)); } }
public ActionResult DomesticFlightClass(AirlineFlighClassViewModel model, int[] ChkFlightClassId) { try { _domesticProvider.DeleteAirlineFlightClasses(model.AirlineId); List <int> ChkFlightClassIdS = new List <int>(); foreach (int Classid in ChkFlightClassId) { model.FlightClassId = Classid; _domesticProvider.AddDomesticAirlineFlightClass(model); } // TODO: Add delete logic here int id = model.AirlineId; TempData["Message"] = "Successfully Updated"; return(RedirectToAction("DomesticFlightClass", new { id = model.AirlineId })); } catch { return(View()); } }
public ActionResult ViewDomesticFlightClass(AirlineFlighClassViewModel model) { if (model.AirlineId != 0) { AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { AirlineId = model.AirlineId, DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), AirlineFlighClass = _domesticProvider.GetFlightClassDomesticAirline(), ActiveFlightClassForAirline = _domesticProvider.GetAllActiveFlightClassForAirline(model.AirlineId).ToList() }; return(View("DomesticFlightClass", viewmodel)); } else { AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), }; return(View("DomesticFlightClass", viewmodel)); } }
// // GET: /DomesticFlightClass/EditFlightClass/5 public ActionResult Edit(int id) { var datamodel = _domesticProvider.GeFlightClassesInfo(id); var viewmodel = new AirlineFlighClassViewModel() { FlightClassId = id, FlightClassCode = datamodel.FlightClassCode, AirlineId = datamodel.AirlineId, HFAirlineId = datamodel.AirlineId, DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), ClassType = datamodel.FlightClassType, }; if (Request != null && Request.IsAjaxRequest()) { return(PartialView("_Edit", viewmodel)); } else { return(View(viewmodel)); } }
public ActionResult DomesticFlightClass(int id) { if (id != 0) { AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { AirlineId = id, DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), AirlineFlighClass = _domesticProvider.GetFlightClassDomesticAirline(), ActiveFlightClassForAirline = _domesticProvider.GetAllActiveFlightClassForAirline(id).ToList() }; return(View(viewmodel)); } else { AirlineFlighClassViewModel viewmodel = new AirlineFlighClassViewModel() { DomesticAirlineList = _domesticProvider.GetDomesticAirlineList(), }; return(View(viewmodel)); } }