public ActionResult EditLubricant(LubricantModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            try
            {
                var lubricant = ModelMapper.GetLubricant(model);
                vehicleService.UpdateLubricantType(lubricant);
                return RedirectToAction("Lubricant");
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult NewLubricant(LubricantModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            try
            {
                var lubricant = ModelMapper.GetLubricant(model);
                vehicleService.AddNewLubricantType(lubricant);
                return RedirectToAction("Lubricant");
            }
            catch
            {
                return View(model);
            }
        }
Ejemplo n.º 3
0
 public static LubricantType GetLubricant(LubricantModel model)
 {
     return new LubricantType()
     {
         Id = model.Id,
         LubricantName = model.LubricantType,
         LubricantRate = model.LubricantRate
     };
 }