public async Task <IActionResult> UpdateSavingsGoal(Guid goalId, [FromBody] SavingsGoalViewModel goal) { var userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var updated = await _savingsGoalService.UpdateSavingsGoal(goalId, userId, goal.Name, goal.CurrentAmount, goal.TargetAmount); if (updated != null) { return(Ok(updated)); } return(StatusCode(500, "Nothing was updated.")); }
public async Task <IActionResult> AddSavingsGoal(SavingsGoalViewModel goal) { var userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var added = await _savingsGoalService.AddSavingsGoal(userId, goal.Name, goal.CurrentAmount, goal.TargetAmount); if (added != null) { return(Ok(added)); } return(StatusCode(500, "Nothing was added.")); }