Ejemplo n.º 1
0
        public async Task OnGetAsync()
        {
            User = await _userManager.GetUserAsync(HttpContext.User);

            var date = DateTime.Now;

            seances = await _context.Seances
                      .Where(s => s.ClasseId == User.ClasseId)
                      .Where(s => s.date.Day < date.Day)
                      .Include(s => s.Classe)
                      .Include(s => s.Matiere)
                      .Include(s => s.Professeur)
                      .OrderBy(s => s.date)
                      .ToListAsync();

            modeleSeanceAbsences = new List <SeanceAbsence>();
            Absence       absence = new Absence();
            SeanceAbsence Inter;

            foreach (var item in seances)
            {
                Inter   = new SeanceAbsence();
                absence = await _context.Absences
                          .Where(s => s.SeanceId == item.Id)
                          .Where(s => s.EtudiantId == User.Id)
                          .FirstOrDefaultAsync();

                Inter.seance  = item;
                Inter.absence = absence;
                modeleSeanceAbsences.Add(Inter);
            }
        }
Ejemplo n.º 2
0
        public async Task OnGetAsync()
        {
            User = await _userManager.GetUserAsync(HttpContext.User);

            var date = DateTime.Now;

            seanceActuel = _context.Seances
                           .Where(s => s.ClasseId == User.ClasseId)
                           .Where(s => s.date >= date && s.date <= date.AddHours(1))
                           .Include(s => s.Classe)
                           .Include(s => s.Matiere)
                           .Include(s => s.Professeur).FirstOrDefault();
            classe = _context.Classes.Find(User.ClasseId);


            Seances = await _context.Seances
                      .Where(s => s.ClasseId == User.ClasseId)
                      .Where(s => s.date.Day == date.Day)
                      .Include(s => s.Classe)
                      .Include(s => s.Matiere)
                      .Include(s => s.Professeur)
                      .ToListAsync();

            modelSeanceAbsence = new List <SeanceAbsence>();
            Absence       absence = new Absence();
            SeanceAbsence Inter;

            foreach (var item in Seances)
            {
                Inter   = new SeanceAbsence();
                absence = await _context.Absences
                          .Where(s => s.SeanceId == item.Id)
                          .Where(s => s.EtudiantId == User.Id)
                          .FirstOrDefaultAsync();

                Inter.seance  = item;
                Inter.absence = absence;
                modelSeanceAbsence.Add(Inter);

                if (seanceActuel != null && Inter.seance.Id == seanceActuel.Id)
                {
                    etatSeanceActuel = Inter.absence.statut;
                }
            }
        }