public async Task <IActionResult> Details(Guid id) { var goal = await _repo.GetGoal(id); if (goal == null) { return(NotFound()); } var model = new SavingsGoalProgressViewModel(); model.SavingsGoal = goal; model.Progress = await _repo.CalculateProgress(goal); return(View(model)); }
public async Task <IActionResult> Goals() { var goals = await _repo.GetList <SavingsGoal>(); List <SavingsGoalProgressViewModel> model = new List <SavingsGoalProgressViewModel>(); foreach (var goal in goals) { var item = new SavingsGoalProgressViewModel(); item.SavingsGoal = goal; item.Progress = await _repo.CalculateProgress(goal); model.Add(item); } return(View(model)); }