Esempio n. 1
0
        public async Task OnGetAsync()
        {
            var userEmail = User.Identity.Name;
            var lecturer  = await _context.Lecturer.FirstOrDefaultAsync(l => l.Email == userEmail);

            LecturerName = lecturer.Name;
            Courses      = await _context.Course.Where(c => !c.isModel).ToListAsync();

            Classrooms = await _context.ClassRoom.ToListAsync();

            Lecturers = await _context.Lecturer.ToListAsync();

            Sessions = await _context.Session.ToListAsync();

            LecturerSessions = Sessions.Where(s => s.Course.Lecturer.Email == userEmail).ToList();
            UpcomingSessions = LecturerSessions.Where(s => s.Time > DateTime.Now).ToList();
            UpcomingSessions = UpcomingSessions.OrderBy(s => s.Time).ToList();
            PastSessions     = LecturerSessions.Where(s => s.Time <= DateTime.Now).ToList();
            PastSessions     = PastSessions.OrderBy(s => s.Time).ToList();
            GlobalVariables  = _context.GlobalVariables.First();
            DayOfWeek day   = DateTime.Now.DayOfWeek;
            int       days  = day - DayOfWeek.Monday;
            DateTime  start = DateTime.Now.AddDays(-days);

            Week = start.ToString("dd.MM") + "-" + start.AddDays(6).ToString("dd.MM");
        }
Esempio n. 2
0
        public async Task OnGetAsync()
        {
            Seats = await _context.Seat.ToListAsync();

            Cases = await _context.Cases.ToListAsync();

            Courses = await _context.Course.ToListAsync();

            Classrooms = await _context.ClassRoom.ToListAsync();

            Students = await _context.Student.Where(s => !s.isModel).ToListAsync();

            UpcomingSessions = await _context.Session.Where(s => s.Time > DateTime.Now).ToListAsync();

            UpcomingSessions = UpcomingSessions.OrderBy(s => s.Time).ToList();
            PastSessions     = await _context.Session.Where(s => s.Time <= DateTime.Now).ToListAsync();

            PastSessions    = PastSessions.OrderBy(s => s.Time).ToList();
            GlobalVariables = _context.GlobalVariables.First();
        }