コード例 #1
0
        public async Task <IActionResult> Novo(AmigoViewModel amigoViewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(amigoViewModel));
                }

                await _amigoService.Add(amigoViewModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception)
            {
                TratarErro();
            }

            return(View());
        }