Exemplo n.º 1
0
        public ActionResult Create(ClienteEnderecoViewModel clienteEnderecoViewModel)
        {
            if (ModelState.IsValid)
            {
                _filiacaoAppService.Adicionar(clienteEnderecoViewModel);
                return(RedirectToAction("Index"));
            }

            return(View(clienteEnderecoViewModel));
        }
Exemplo n.º 2
0
        public ActionResult Create(ClienteEnderecoViewModel clienteEnderecoViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(clienteEnderecoViewModel));
            }

            var clienteReturn = _filiacaoAppService.Adicionar(clienteEnderecoViewModel).ClienteViewModel;

            if (clienteReturn.ValidationResult.IsValid)
            {
                return(RedirectToAction("Index"));
            }

            foreach (var erro in clienteReturn.ValidationResult.Erros)
            {
                ModelState.AddModelError(string.Empty, erro.Message);
            }

            return(View(clienteEnderecoViewModel));
        }