public ActionResult Delete(int id) { var bll = new dtoProducto(); var producto = bll.BuscarUnProducto(id); App_Start.AutoMapperWebConfiguration.Configure(); var vmodel = Mapper.Map <dtoProducto, ProductoViewModels>(producto); return(View(vmodel)); }
public ActionResult Edit(int id) { var bll = new dtoProducto(); var pr = bll.BuscarUnProducto(id); var bllcat = new UAIBay.BLL.DTO.dtoCategoria(); var categoriasDTO = bllcat.TraerCategorias(); App_Start.AutoMapperWebConfiguration.Configure(); var vmodel = Mapper.Map <dtoProducto, ProductoViewModels>(pr); var categoriasViewmodel = Mapper.Map <List <CategoriaViewModels> >(categoriasDTO); ViewBag.Categorias = categoriasViewmodel.Select(x => new SelectListItem { Text = x.Nombre, Value = x.IdCategoria.ToString() }).ToList(); return(View(vmodel)); }