public IActionResult Save(GoalModel goal) { var userID = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; if (!ModelState.IsValid) { var viewModel = new GoalFormViewModel { Goal = goal, DefaultCurrencySymbol = _accountService.GetUserDefaultCurrencySymbol(userID) }; return(View("GoalForm", viewModel)); } if (goal.ID == 0) { _goalService.AddGoal(goal); } else { _goalService.UpdateGoal(goal); } return(RedirectToAction("MainPage", "Transaction")); }
public async Task <ActionResult <GoalResponse> > AddGoal(GoalRequest request) { return(Ok(await _goalService.AddGoal(UserId, request))); }