public ViewResult Details(int id) { ServicioVM servicioVM = new ServicioVM(); Servicio servicio = repository.LoadById(id); Mapper.Map(servicio, servicioVM); return View(servicioVM); }
public ActionResult Delete(int id) { ServicioVM servicioVM = new ServicioVM(); Servicio servicio = repository.LoadById(id); Mapper.Map(servicio, servicioVM); return View(servicioVM); }
public ActionResult DeleteConfirmed(int id) { ServicioVM servicioVM = new ServicioVM(); Servicio servicio = repository.LoadById(id); Mapper.Map(servicio, servicioVM); repository.Delete(servicio); repository.Save(); return RedirectToAction("Index"); }
public ActionResult Create(ServicioVM servicioVM) { Servicio servicio = new Servicio(); if (ModelState.IsValid) { Mapper.Map(servicioVM, servicio); repository.Add(servicio); repository.Save(); return RedirectToAction("Index"); } return View(servicioVM); }
public ActionResult Edit(ServicioVM servicioVM) { Servicio servicio = repository.LoadById(servicioVM.ServicioId); if (ModelState.IsValid) { Mapper.Map(servicioVM, servicio); //repository.Add(servicio); repository.Save(); servicioVM.ServicioId = servicio.ServicioId; return RedirectToAction("Index"); } return View(servicioVM); }