Example #1
0
        public async Task <IActionResult> OnGetAsync()
        {
            await db.Objects.LoadAsync();

            await db.Classes.LoadAsync();

            await db.DayObjects.LoadAsync();

            User admin = await db.Users.FirstOrDefaultAsync(u => u.UserId.ToString() == User.Identity.Name);

            NonVerifiedUsers = db.Users.Where(u => (u.Class.SchoolId == admin.Class.SchoolId) && (u.IsVerified == false));

            DateTime monday   = dateService.GetMondayOfWeek();
            DateTime saturday = dateService.GetSaturdayOfWeek();

            Week = db.Days
                   .Where(d => (d.Date.Date >= monday.Date) && (d.Date.Date <= saturday.Date))
                   .Where(d => d.ClassId == admin.ClassId)
                   .Include(d => d.DayObjects);
            Objects = new SelectList(db.Objects, "ObjectName", "ObjectName");

            News = db.News.Where(n => n.SchoolId == admin.Class.SchoolId);

            return(Page());
        }