public VehicleTypeForm(VehicleType vehicleType) { _vehicleTypeService = new VehicleTypeBLL(); InitializeComponent(); this.vehicleType = vehicleType; PopulateForm(); }
public ActionResult Edit(VehicleTypeList model) { SetActiveMenuItem(); if (!ModelState.IsValid) { return(View(model)); } try { //Set our updater name var FullName = Request.Cookies["userInfo"]["FullName"]; //Now update the record VehicleTypeBLL.UpdateVehicleType(model, FullName); //Take our ID with us to the confirmation form ViewBag.Id = model.Id; //Determine the kind of SQL transaction we have performed ViewBag.Message = "updated"; //We can now safely go to the confirmation view return(View("AddUpdateConfirm")); } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(Redirect("~/Admin/Home/Error")); } }
public ActionResult Create(VehicleTypeList model) { if (!ModelState.IsValid) { return(View(model)); } try { //Set our initial return value var returnValue = 0; //Set our updater name var FullName = Request.Cookies["userInfo"]["FullName"]; //Attempt to add our record VehicleTypeBLL.AddVehicleType(model, FullName, out returnValue); //Take our ID with us to the confirmation form ViewBag.Id = returnValue; //Determine the kind of SQL transaction we have performed ViewBag.Message = "added"; //We can now safely go to the confirmation view return(View("AddUpdateConfirm")); } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(Redirect("~/Admin/Home/Error")); } }
public VehicleForm() { _vehicleService = new VehicleBLL(); InitializeComponent(); vehicleTypeBll = new VehicleTypeBLL(); stationBll = new StationBLL(); vehicleTypes = vehicleTypeBll.GetAll(); stations = stationBll.GetAll(); cmbVehicleTypeId.DataSource = vehicleTypes; cmbStationId.DataSource = stations; }
// GET: /Admin/VehicleType/Edit public ActionResult Edit(int id) { SetActiveMenuItem(); try { var model = VehicleTypeBLL.GetVehicleType(id); return(View(model: model)); } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(Redirect("~/Admin/Home/Error")); } }
public StationResponseForm() { _stationResponseService = new StationResponseBLL(); InitializeComponent(); responseBll = new ResponseBLL(); stationBLL = new StationBLL(); vehicleTypeBLL = new VehicleTypeBLL(); responses = responseBll.GetAll(); stations = stationBLL.GetAll(); vehicleTypes = vehicleTypeBLL.GetAll(); cmbResponseId.DataSource = responses; cmbStationId.DataSource = stations; cmbVehicleTypeId.DataSource = vehicleTypes; }
public VehicleTypeListForm() { _vehicleTypeService = new VehicleTypeBLL(); InitializeComponent(); }