private List <ForecastReportRow> GetProgramForecastMatrixRow(SustainabilityProgram program, DateTime firstMonth, DateTime lastMonth, int forecastMonths)
        {
            List <ForecastReportRow> rows = new List <ForecastReportRow>();


            foreach (StaffMember staff in program.Staff)
            {
                Dictionary <DateTime, decimal> monthlyHours = InitializeEmptyMonthlyHours(firstMonth, lastMonth.AddMonths(forecastMonths));
                var staffProjectSchedules = FetchAllStaffProjectSchedules(staff.StaffMemberId)
                                            .Where(p => p.Project.SustainabilityProgramId == program.SustainabilityProgramId);

                // get staff project rows
                List <Dictionary <DateTime, decimal> > staffProjectMonthyHourRows = FetchStaffProjectMonthlyHourRows(monthlyHours, staffProjectSchedules);

                // sum up months
                List <decimal>    hours = CalculateSumOfAllMonthlyHourRows(staffProjectMonthyHourRows).Values.ToList();
                ForecastReportRow row   = new ForecastReportRow();
                rows.Add(new ForecastReportRow {
                    SustainabilityProgram = program,
                    StaffMember           = staff,
                    HoursList             = hours
                });
            }
            return(rows);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SustainabilityProgram = await _context.SustainabilityProgram.FirstOrDefaultAsync(m => m.SustainabilityProgramId == id);

            if (SustainabilityProgram == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SustainabilityProgram = await _context.SustainabilityProgram.FirstOrDefaultAsync(m => m.SustainabilityProgramId == id);

            if (SustainabilityProgram == null)
            {
                return(NotFound());
            }

            ViewData["AssociatedStaffMembers"] = await _context.StaffMember
                                                 .Where(s => s.SustainabilityProgramId == id)
                                                 .ToListAsync();

            ViewData["AssociatedProjects"] = await _context.Project
                                             .Where(p => p.SustainabilityProgramId == id)
                                             .ToListAsync();

            return(Page());
        }