Example #1
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"));
        }
        // 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 }));
        }
Example #3
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 }));
        }
Example #4
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 }));
        }
        // 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 }));
        }
Example #6
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"));
        }
        // 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 }));
        }