コード例 #1
0
        public async Task <IActionResult> Create(CreateGoalsCommand command)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var appUser = await _userService.GetUserAsync(User);

                    var id = _service.CreateGoal(command, appUser);
                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (Exception)
            {
                ModelState.AddModelError(
                    string.Empty,
                    "An error occured saving the goal"
                    );
            }
            return(View(command));
        }