Пример #1
0
        // 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));
        }
Пример #2
0
 public ActionResult Delete(ItemEntradaViewModel itemEntradaViewModel, int entradaId)
 {
     try
     {
         _itemEntradaServicoAplicacao.Excluir(itemEntradaViewModel.Id);
         return(RedirectToAction("Details", "Entradas", new { id = entradaId }));
     }
     catch
     {
         return(View(itemEntradaViewModel));
     }
 }
Пример #3
0
 public ActionResult Edit(ItemEntradaViewModel itemEntradaViewModel, int entradaId)
 {
     try
     {
         _itemEntradaServicoAplicacao.Atualizar(itemEntradaViewModel);
         return(RedirectToAction("Details", "Entradas", new { id = entradaId }));
     }
     catch
     {
         return(View());
     }
 }
Пример #4
0
 public ActionResult Create(ItemEntradaViewModel itemEntradaViewModel)
 {
     try
     {
         _itemEntradaServicoAplicacao.Adicionar(itemEntradaViewModel);
         return(RedirectToAction("Details", "Entradas", new { id = itemEntradaViewModel.EntradaId }));
     }
     catch
     {
         return(View());
     }
 }
Пример #5
0
 public void Adicionar(ItemEntradaViewModel itemEntradaViewModel)
 {
     try
     {
         var itemEntrada = _mapper.Map <ItemEntrada>(itemEntradaViewModel);
         itemEntrada.CalculaTotalItem();
         itemEntrada.CalculaPrcCusto();
         _itemEntradaServicoDominio.Adicionar(itemEntrada);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #6
0
        public void Atualizar(ItemEntradaViewModel itemEntradaViewModel)
        {
            var itemEntrada = _mapper.Map <ItemEntrada>(itemEntradaViewModel);

            _itemEntradaServicoDominio.Atualizar(itemEntrada);
        }