public ActionResult EditAlquiler(DepartamentoAlquilerViewModel model, HttpPostedFileBase[] files) { if (ModelState.IsValid) { Mapper.CreateMap <DepartamentoAlquilerViewModel, depa_alquiler>(); var entity = Mapper.Map <DepartamentoAlquilerViewModel, depa_alquiler>(model); _articleService.Update(entity); addResources(model.id, files); } return(RedirectToAction("depa_alquiler", new { id = model.id })); }
public ActionResult CreateAlquiler(DepartamentoAlquilerViewModel model, HttpPostedFileBase[] files) { int article_id = 0; if (ModelState.IsValid) { var customer = _customerService.getCustomerById(model.customer_id); if (customer == null) { throw new InvalidOperationException("Cliente no encontrado"); } Mapper.CreateMap <DepartamentoAlquilerViewModel, depa_alquiler>(); var entity = Mapper.Map <DepartamentoAlquilerViewModel, depa_alquiler>(model); article_id = _articleService.Create(entity); addResources(article_id, files); } return(RedirectToAction("depa_alquiler", new { id = article_id })); }