public ActionResult Create(LoteViewModel model) { try { var service = new FabricacionServices.LotesServiceClient(); service.InsertarLote(model.NroLote, 1); return RedirectToAction("Index", new {creado = true}); } catch { return View(); } }
// // GET: /Lote/ public ActionResult Index(bool? creado) { var service = new FabricacionServices.LotesServiceClient(); var dtos = service.ListaLotes(); Mapper.CreateMap<LoteDto, LoteViewModel>(); var model = Mapper.Map<List<LoteViewModel>>(dtos); if (creado.HasValue && creado.GetValueOrDefault()) ViewBag.MensajeConfirmacion = "El lote se insertó correctamente"; return View(model); }
public ActionResult Edit(LoteViewModel model) { try { var service = new FabricacionServices.LotesServiceClient(); service.EditarLote(model.Id, model.NroLote); return Index(true); } catch { return View(); } }