コード例 #1
0
        public ActionResult Cadastrar(NovoAlunoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = _alunoAppService.CadastrarNovoAluno(model);

                if (result.IsValid)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    foreach (var item in result.Erros)
                    {
                        ModelState.AddModelError("", item.Message);
                    }
                }
            }
            return(View(model));
        }