public static FuelType GetFuel(FuelModel model) { return new FuelType() { Id = model.Id, FuelName = model.FuelType, FuelRate = model.FuelRate }; }
public ActionResult NewFuel(FuelModel model) { if (!ModelState.IsValid) { return View(model); } try { var fuelType = ModelMapper.GetFuel(model); vehicleService.AddNewFuelType(fuelType); return RedirectToAction("Fuel"); } catch { return View(model); } }
public ActionResult EditFuel(FuelModel model) { if (!ModelState.IsValid) return View(model); try { var fuel = ModelMapper.GetFuel(model); vehicleService.UpdateFuelType(fuel); return RedirectToAction("Fuel"); } catch (Exception) { throw; } }