public ActionResult Editar(int id, CarVM model) { try { var car = Map(model); _carService.Update(car); return RedirectToAction("Index"); } catch { return View(model); } }
public Car Map(CarVM model) { return Mapper.Map<CarVM, Car>(model); }
public ActionResult Deletar(int id, CarVM model) { try { var car = Map(model); _carService.Delete(car); return RedirectToAction("Index"); } catch (ArgumentOutOfRangeException) { //modal return RedirectToAction("Index"); } catch { return View(model); } }