Exemple #1
0
        public void Creates_the_active_period_of_a_given_date(int year, int month, int day, int expectedYear,
                                                              int expectedMonth, int expectedDay)
        {
            var period = Period.CreateCurrentlyActivePeriodBy(new DateTime(year, month, day));

            period.Value.StartDate.Should().Be(new DateTime(expectedYear, expectedMonth, expectedDay));
        }
        public async Task <IActionResult> OnGetAsync(DateTime?date)
        {
            if (!date.HasValue)
            {
                return(RedirectToPage("./Index", new { date = DateTime.Now.ToString("yyyy-M-d") }));
            }

            CurrentPeriod = Period.CreateCurrentlyActivePeriodBy(DateTime.Today).Value;
            var groups = await _context.Groups
                         .OrderByDescending(g => g.Period)
                         .ToListAsync();

            StudentGroups = groups.Where(g => g.Period.IsVeryOldDate).ToList();
            StudentGroups.AddRange(groups.Where(g => !g.Period.IsVeryOldDate).ToList());
            return(Page());
        }