public EnderecoViewModel AdicionarEndereco(EnderecoViewModel enderecoViewModel) { var endereco = Mapper.Map <EnderecoViewModel, Endereco>(enderecoViewModel); BeginTransaction(); _clienteService.AdicionarEndereco(endereco); Commit(); return(enderecoViewModel); }
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")); }