public async Task <IActionResult> OnPostAsync(int?id, int?idNiveau, int?idFiliere)
        {
            if (idNiveau != null)
            {
                IdNiv = (int)idNiveau;
            }
            if (idFiliere != null)
            {
                IdFil = (int)idFiliere;
            }

            if (id == null)
            {
                return(NotFound());
            }

            Etudiant = await _context.Etudiants.FindAsync(id);

            if (Etudiant != null)
            {
                _context.Etudiants.Remove(Etudiant);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index", new { idFiliere = IdFil, idNiveau = IdNiv }));
        }
示例#2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?idDepartement)
        {
            if (idDepartement != null)
            {
                IdDept = (int)idDepartement;
                Enseignant.DepartementID = (int)idDepartement;
                Enseignant.RoleID        = 2;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Enseignant).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EnseignantExists(Enseignant.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index", new { idDepartement = IdDept }));
        }
        public async Task <IActionResult> OnPostAsync(int?id, int?idModule, int?idNiveau, int?idFiliere)
        {
            if (idModule != null)
            {
                IdMod = (int)idModule;
            }
            if (idNiveau != null)
            {
                IdNiv = (int)idNiveau;
            }
            if (idFiliere != null)
            {
                IdFil = (int)idFiliere;
            }

            if (id == null)
            {
                return(NotFound());
            }

            Matiere = await _context.Matieres.FindAsync(id);

            if (Matiere != null)
            {
                _context.Matieres.Remove(Matiere);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index", new { idFiliere = IdFil, idNiveau = IdNiv, idModule = IdMod }));
        }
示例#4
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync(int?idModule, int?idNiveau, int?idFiliere)
        {
            if (idModule != null)
            {
                IdMod            = (int)idModule;
                Matiere.ModuleID = (int)idModule;
            }
            if (idNiveau != null)
            {
                IdNiv = (int)idNiveau;
            }
            if (idFiliere != null)
            {
                IdFil = (int)idFiliere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Matieres.Add(Matiere);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index", new { idFiliere = IdFil, idNiveau = IdNiv, idModule = IdMod }));
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?idFiliere)
        {
            if (idFiliere != null)
            {
                IdFil            = (int)idFiliere;
                Niveau.FiliereID = (int)idFiliere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Niveau).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NiveauExists(Niveau.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index", new { idFiliere = IdFil }));
        }
示例#6
0
        public async Task <IActionResult> OnPostAsync(int?id, int?idMatiere, int?idSeance)
        {
            if (idSeance != null)
            {
                IdSe = (int)idSeance;
            }
            if (idMatiere != null)
            {
                IdMat = (int)idMatiere;
            }

            if (id == null)
            {
                return(NotFound());
            }

            Absence = await _context.Absences.FindAsync(id);

            if (Absence != null)
            {
                _context.Absences.Remove(Absence);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index", new { idMatiere = IdMat, idSeance = IdSe }));
        }
示例#7
0
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Departement).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DepartementExists(Departement.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        public async Task OnGetAsync(int?idMatiere)
        {
            Etudiant = await _context.Etudiants
                       .Include(e => e.Niveau)
                       .ToListAsync();

            Note = await _context.Notes
                   .Include(n => n.Etudiant)
                   .Include(n => n.Matiere).ToListAsync();

            if (idMatiere != null)
            {
                Note    = Note.Where(e => e.MatiereID == idMatiere).ToList();
                IdMat   = (int)idMatiere;
                Matiere = await _context.Matieres.FindAsync(idMatiere);

                Matiere Mat = new Matiere();
                Mat = _context.Matieres.Find(idMatiere);

                Module Mod = new Module();
                Mod = _context.Modules.Find(Mat.ModuleID);

                Niveau Niv = new Niveau();
                Niv = _context.Nivaux.Find(Mod.NiveauID);

                Etudiant = Etudiant.Where(e => e.NiveauID == Niv.ID).ToList();
            }

            foreach (Etudiant etudiant in Etudiant)
            {
                bool b = false;
                foreach (Note note in Note)
                {
                    if (etudiant.ID == note.EtudiantID)
                    {
                        b = true;
                    }
                }
                if (b == false)
                {
                    Note Note2 = new Models.Note();
                    Note2.EtudiantID = etudiant.ID;
                    Note2.MatiereID  = (int)idMatiere;
                    _context.Notes.Add(Note2);
                }
            }
            await _context.SaveChangesAsync();

            Note = await _context.Notes
                   .Include(n => n.Etudiant)
                   .Include(n => n.Matiere).ToListAsync();

            Note = Note.Where(e => e.MatiereID == idMatiere).OrderBy(n => n.Etudiant.Nom).ToList();
        }
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Filieres.Add(Filiere);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Admin.RoleID = 1;
            _context.Admins.Add(Admin);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
示例#11
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Admin = await _context.Admins.FindAsync(id);

            if (Admin != null)
            {
                _context.Admins.Remove(Admin);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#12
0
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?idMatiere)
        {
            if (idMatiere != null)
            {
                IdMat          = (int)idMatiere;
                Note.MatiereID = (int)idMatiere;
                Absence        = await _context.Absences
                                 .Include(a => a.Seance)
                                 .ThenInclude(a => a.Matiere)
                                 .Include(a => a.Etudiant)
                                 .Where(a => a.EtudiantID == Note.EtudiantID && a.Seance.MatiereID == idMatiere && a.Absence_Justifie == "Non")
                                 .ToListAsync();

                Note.Note_Finale = Note.Note_Initiale - Absence.Count * 2;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Note).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NoteExists(Note.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index", new { idMatiere = IdMat }));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Departement = await _context.Departements.FindAsync(id);

            if (Departement != null)
            {
                _context.Departements.Remove(Departement);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?idModule, int?idNiveau, int?idFiliere, int?idMatiere)
        {
            if (idMatiere != null)
            {
                IdMat            = (int)idMatiere;
                Seance.MatiereID = (int)idMatiere;
            }
            if (idModule != null)
            {
                IdMod = (int)idModule;
            }
            if (idNiveau != null)
            {
                IdNiv = (int)idNiveau;
            }
            if (idFiliere != null)
            {
                IdFil = (int)idFiliere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Seance).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SeanceExists(Seance.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index", new { idFiliere = IdFil, idNiveau = IdNiv, idModule = IdMod, idMatiere = IdMat }));
        }
示例#15
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync(int?idFiliere)
        {
            if (idFiliere != null)
            {
                IdFil            = (int)idFiliere;
                Niveau.FiliereID = (int)idFiliere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Nivaux.Add(Niveau);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index", new { idFiliere = IdFil }));
        }
示例#16
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync(int?idDepartement)
        {
            if (idDepartement != null)
            {
                IdDept = (int)idDepartement;
                Enseignant.DepartementID = (int)idDepartement;
                Enseignant.RoleID        = 2;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Enseignants.Add(Enseignant);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index", new { idDepartement = IdDept }));
        }
示例#17
0
        public async Task <IActionResult> OnPostAsync(int?id, int?idFiliere)
        {
            if (idFiliere != null)
            {
                IdFil = (int)idFiliere;
            }

            if (id == null)
            {
                return(NotFound());
            }

            Niveau = await _context.Nivaux.FindAsync(id);

            if (Niveau != null)
            {
                _context.Nivaux.Remove(Niveau);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index", new { idFiliere = IdFil }));
        }
        public async Task <IActionResult> OnPostAsync(int?id, int?idDepartement)
        {
            if (idDepartement != null)
            {
                IdDept = (int)idDepartement;
            }

            if (id == null)
            {
                return(NotFound());
            }

            Enseignant = await _context.Enseignants.FindAsync(id);

            if (Enseignant != null)
            {
                _context.Enseignants.Remove(Enseignant);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index", new { idDepartement = IdDept }));
        }
示例#19
0
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (file != null)
            {
                if (file.Length > 0 && file.Length < 300000)
                {
                    using (var target = new MemoryStream())
                    {
                        file.CopyTo(target);
                        Absence.Fichier = target.ToArray();
                    }
                }
            }
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Absence).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AbsenceExists(Absence.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./EtudiantAbsences"));
        }
示例#20
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync(int?idMatiere, int?idSeance)
        {
            if (idSeance != null)
            {
                IdSe                     = (int)idSeance;
                Absence.SeanceID         = (int)idSeance;
                Absence.Absence_Justifie = "Non";
            }
            if (idMatiere != null)
            {
                IdMat = (int)idMatiere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Absences.Add(Absence);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index", new { idMatiere = IdMat, idSeance = IdSe }));
        }
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync(int?idNiveau, int?idFiliere)
        {
            if (idNiveau != null)
            {
                IdNiv             = (int)idNiveau;
                Etudiant.NiveauID = (int)idNiveau;
                Etudiant.RoleID   = 3;
            }
            if (idFiliere != null)
            {
                IdFil = (int)idFiliere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Etudiants.Add(Etudiant);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index", new { idFiliere = IdFil, idNiveau = IdNiv }));
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to.
        // For more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?idMatiere, int?idSeance)
        {
            if (idSeance != null)
            {
                IdSe             = (int)idSeance;
                Absence.SeanceID = (int)idSeance;
            }
            if (idMatiere != null)
            {
                IdMat = (int)idMatiere;
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Absence).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AbsenceExists(Absence.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index", new { idMatiere = IdMat, idSeance = IdSe }));
        }