예제 #1
0
        public EnderecoViewModel AdicionarEndereco(EnderecoViewModel enderecoViewModel)
        {
            var endereco = Mapper.Map <EnderecoViewModel, Endereco>(enderecoViewModel);

            BeginTransaction();
            _clienteService.AdicionarEndereco(endereco);
            Commit();

            return(enderecoViewModel);
        }
예제 #2
0
        public async Task <IActionResult> NovoEndereco(EnderecoViewModel endereco)
        {
            var response = await _clienteService.AdicionarEndereco(endereco);

            if (ResponsePossuiErros(response))
            {
                TempData["Erros"] = ModelState.Values.SelectMany(x => x.Errors.Select(e => e.ErrorMessage)).ToList();
            }

            return(RedirectToAction("EnderecoEntrega", "Pedido"));
        }