Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }