public async Task <IActionResult> Create(PersonViewModel personViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(personViewModel));
            }

            await _personAppService.Register(personViewModel);

            if (IsValidOperation())
            {
                ViewBag.Sucesso = "Cadastro realizado com sucesso!";
            }

            return(View(personViewModel));
        }
示例#2
0
 public async Task <IActionResult> Post([FromBody] PersonViewModel personViewModel)
 {
     return(!ModelState.IsValid ? CustomResponse(ModelState) : CustomResponse(await _personAppService.Register(personViewModel)));
 }