// GET: LojasController/Create public ActionResult Create(int entradaId) { var itemEntrada = new ItemEntradaViewModel(); itemEntrada.EntradaId = entradaId; itemEntrada.Entrada = _entradaServicoAplicacao.DetalharId(entradaId); ViewBag.produtoId = new SelectList(_produtoServicoAplicacao.Listar(), "Id", "Descricao"); return(View(itemEntrada)); }
public ActionResult Delete(ItemEntradaViewModel itemEntradaViewModel, int entradaId) { try { _itemEntradaServicoAplicacao.Excluir(itemEntradaViewModel.Id); return(RedirectToAction("Details", "Entradas", new { id = entradaId })); } catch { return(View(itemEntradaViewModel)); } }
public ActionResult Edit(ItemEntradaViewModel itemEntradaViewModel, int entradaId) { try { _itemEntradaServicoAplicacao.Atualizar(itemEntradaViewModel); return(RedirectToAction("Details", "Entradas", new { id = entradaId })); } catch { return(View()); } }
public ActionResult Create(ItemEntradaViewModel itemEntradaViewModel) { try { _itemEntradaServicoAplicacao.Adicionar(itemEntradaViewModel); return(RedirectToAction("Details", "Entradas", new { id = itemEntradaViewModel.EntradaId })); } catch { return(View()); } }
public void Adicionar(ItemEntradaViewModel itemEntradaViewModel) { try { var itemEntrada = _mapper.Map <ItemEntrada>(itemEntradaViewModel); itemEntrada.CalculaTotalItem(); itemEntrada.CalculaPrcCusto(); _itemEntradaServicoDominio.Adicionar(itemEntrada); } catch (Exception e) { throw e; } }
public void Atualizar(ItemEntradaViewModel itemEntradaViewModel) { var itemEntrada = _mapper.Map <ItemEntrada>(itemEntradaViewModel); _itemEntradaServicoDominio.Atualizar(itemEntrada); }