Пример #1
0
        public ActionResult Edit(ContatoModel contatoModel)
        {
            try
            {
                contatoModel = _contatoAppService.Editar(contatoModel);

                foreach (var erro in contatoModel.ListaErros)
                {
                    ModelState.AddModelError(erro.Key, erro.Value);
                }

                if (ModelState.IsValid)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    return(View(contatoModel));
                }
            }
            catch
            {
                return(View());
            }
        }