public void Initialise(System.Web.UI.Page p) { _page = p; if (p.IsPostBack) { return; } if (_page.Session["IFleetOverviewController"] != null) { repopulateFilters(); } else { ThreeCascadeModel.bind(); OwnCountryModel.bind(); CarSegmentModel.clear(); CarClassModel.clear(); CarGroupModel.clear(); VehiclePredicamentModel.bind(); VehiclePredicamentModel.SelectedIndex = 3; if (_page.Session["IForeignNonRevenueController"] != null) { fromNonRev(); } } OperstatModel.bind(); MoveTypeModel.bind(); NonRevDaysModel.FirstItem = ""; NonRevDaysModel.bind(); PagerMaxModel.bind(); UpdateView(); }
private bool UpdateCarClass(CarClassModel carClass) { CarClass databaseCarClass = new CarClassCollection().Get(carClass.Id); databaseCarClass.SetName(carClass.Name); return(databaseCarClass.Update()); }
private bool CreateCarClass(CarClassModel carClass) { CarClass carClassObject = new CarClass() { Name = carClass.Name }; return(new CarClassCollection().Create(carClassObject)); }
private CarClassModel GetCarClass(int carClassId) { CarClass databaseCarClass = new CarClassCollection().Get(carClassId); CarClassModel carClass = new CarClassModel() { Id = databaseCarClass.Id, Name = databaseCarClass.Name }; return(carClass); }
void setFeedback() { ThreeCascadeModel.DueCountryModel.SetFeedback(); ThreeCascadeModel.PoolModel.SetFeedback(); ThreeCascadeModel.LocationGroupModel.SetFeedback(); OwnCountryModel.SetFeedback(); CarSegmentModel.SetFeedback(); CarClassModel.SetFeedback(); CarGroupModel.SetFeedback(); VehiclePredicamentModel.SetFeedback(); }
private void repopulateFilters() { IFleetOverviewController foc = (IFleetOverviewController)_page.Session["IFleetOverviewController"]; ThreeCascadeModel.rebind(foc.ThreeCascadeModel.DueCountryModel.SelectedIndex, foc.ThreeCascadeModel.PoolModel.SelectedIndex, foc.ThreeCascadeModel.LocationGroupModel.SelectedIndex, foc.ThreeCascadeModel.DueCountryModel.SelectedValue, foc.ThreeCascadeModel.PoolModel.SelectedValue); OwnCountryModel.rebind(foc.OwnCountryModel.SelectedIndex); CarSegmentModel.rebind(foc.CarSegmentModel.SelectedIndex, OwnCountryModel.SelectedValue); CarClassModel.rebind(foc.CarClassModel.SelectedIndex, OwnCountryModel.SelectedValue, CarSegmentModel.SelectedValue); CarGroupModel.rebind(foc.CarClassModel.SelectedIndex, OwnCountryModel.SelectedValue, CarSegmentModel.SelectedValue, CarClassModel.SelectedValue); VehiclePredicamentModel.rebind(foc.VehiclePredicamentModel.SelectedIndex); //_page.Session["IFleetOverviewController"] = null; }
public IActionResult Create(CarClassModel carClass) { if (CreateCarClass(carClass)) { return(RedirectToAction("Index")); } else { TempData.Add("Alert", "Something went wrong uploading data to the server"); return(View()); } }
public IActionResult Delete(CarClassModel carClass) { if (DeleteCarClass(carClass.Id)) { return(RedirectToAction("Index")); } else { TempData.Add("Alert", "Something went wrong deleting data from the server"); return(View(carClass)); } }
public void CarSegmentSelected() { if (CarSegmentModel.SelectedIndex <= 0) { CarClassModel.clear(); } else { CarClassModel.bind(OwnCountryModel.SelectedValue, CarSegmentModel.SelectedValue); } CarGroupModel.clear(); UpdateView(); }
void setFeedback() { OperstatModel.SetFeedback(); MoveTypeModel.SetFeedback(); VehiclePredicamentModel.SetFeedback(); NonRevDaysModel.SetFeedback(); ThreeCascadeModel.DueCountryModel.SetFeedback(); ThreeCascadeModel.PoolModel.SetFeedback(); ThreeCascadeModel.LocationGroupModel.SetFeedback(); OwnCountryModel.SetFeedback(); CarSegmentModel.SetFeedback(); CarClassModel.SetFeedback(); CarGroupModel.SetFeedback(); }
public void Initialise(System.Web.UI.Page p) { _page = p; if (p.IsPostBack) { checkPostback(); return; } ThreeCascadeModel.bind(); OwnCountryModel.bind(); CarSegmentModel.clear(); CarClassModel.clear(); CarGroupModel.clear(); VehiclePredicamentModel.bind(); VehiclePredicamentModel.SelectedIndex = 3; UpdateView(); }
public IActionResult AddCarClass([FromBody] CarClassModel model) { try { if (model == null) { return(BadRequest("Body content is not valid!")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var entity = model.Map <CarClassEntity>(); entity = _carClassLogic.AddCarClass(entity); if (entity == null) { throw new Exception("Somthing went wrong while adding model to DB!"); } return(Ok(entity)); } catch (Exception e) { return(StatusCode(500, e)); } }