예제 #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");
        }
예제 #2
0
        public async Task OnGetAsync()
        {
            Courses = await _context.Course.ToListAsync();

            Classrooms = await _context.ClassRoom.ToListAsync();

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

            Sessions = Sessions.OrderBy(s => s.Time).ToList();
            Seats    = await _context.Seat.ToListAsync();

            Students = await _context.Student.ToListAsync();

            SelectSession = new SelectList(Sessions, nameof(Session.ID), nameof(Session.Name), null, nameof(Session.CourseName));
            foreach (Session sess in Sessions)
            {
                foreach (Seat seat in sess.ClassRoom.Seats)
                {
                    if (seat.Student.Name == User.Identity.Name)
                    {
                        UpcomingSessions.Add(sess);
                        break;
                    }
                }
            }
            UpcomingSessions = UpcomingSessions.OrderBy(s => s.Time).ToList();
            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");
        }
예제 #3
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();
        }