public IActionResult Create(Expense expense)
        {
            expenseRepo.Create(expense);

            var project = projectRepo.GetById(expense.ProjectId);

            project.ProjectTotalExpenses = expenseRepo.ExpenseTotal(project);
            expenseRepo.Save();
            return(RedirectToAction("Create"));
        }
        public IActionResult Details(int id)
        {
            var model = projectRepo.GetById(id);

            model.ProjectTotalExpenses = expenseRepo.ExpenseTotal(model);
            return(View(model));
        }
Exemple #3
0
        public IActionResult Dashboard()
        {
            var model = projectRepo.GetAll();

            model = from project in model
                    where project.ProjectOwnerId == User.FindFirstValue(ClaimTypes.NameIdentifier) //must be true
                    orderby project.ProjectId                                                      // sorts by the date
                    select project;

            foreach (var projectTotal in model)
            {
                projectTotal.ProjectTotalExpenses = expenseRepo.ExpenseTotal(projectTotal);
            }
            return(View(model));
        }