示例#1
0
        public ActionResult Create(ClienteTelefoneEnderecoViewModel clienteEnderecoViewModel)
        {
            if (ModelState.IsValid)
            {
                clienteEnderecoViewModel = _clienteApplication.Adicionar(clienteEnderecoViewModel);

                if (!clienteEnderecoViewModel.ValidationResult.IsValid)
                {
                    foreach (var erro in clienteEnderecoViewModel.ValidationResult.Erros)
                    {
                        ModelState.AddModelError(string.Empty, erro.Message);
                    }
                    return(View(clienteEnderecoViewModel));
                }

                if (!clienteEnderecoViewModel.ValidationResult.Message.IsNullOrWhiteSpace())
                {
                    ViewBag.Sucesso = clienteEnderecoViewModel.ValidationResult.Message;
                    return(View(clienteEnderecoViewModel));
                }

                return(RedirectToAction("Index"));
            }

            return(View(clienteEnderecoViewModel));
        }
示例#2
0
 public ClienteTelefoneEnderecoViewModel Criar(ClienteTelefoneEnderecoViewModel clienteTelefoneEnderecoViewModel)
 {
     return(_clienteApplication.Adicionar(clienteTelefoneEnderecoViewModel));
 }