public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Module module = await _context.Modules
                            .Include(i => i.Module_Matieres)
                            .SingleAsync(i => i.ModuleID == id);

            if (module == null)
            {
                return(RedirectToPage("./Index"));
            }

            _context.Modules.Remove(module);

            await _context.SaveChangesAsync();

            Module = await _context.Modules.FindAsync(id);

            if (Module != null)
            {
                _context.Modules.Remove(Module);
                await _context.SaveChangesAsync();
            }

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

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


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

            try
            {
                _context.Departements.Remove(Departement);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.)
                return(RedirectToAction("./Delete",
                                        new { id, saveChangesError = true }));
            }
        }
Beispiel #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()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfesseurExists(Professeur.ProfesseurID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

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

            _context.Notes.Add(Note);
            await _context.SaveChangesAsync();

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

            Sceance = await _context.Sceances.FindAsync(id);

            if (Sceance != null)
            {
                _context.Sceances.Remove(Sceance);
                await _context.SaveChangesAsync();
            }

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

            Professeur = await _context.Professeurs.FindAsync(id);

            if (Professeur != null)
            {
                _context.Professeurs.Remove(Professeur);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #7
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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

            Administration = await _context.Administrations.FindAsync(id);

            if (Administration != null)
            {
                _context.Administrations.Remove(Administration);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Niveau = await _context.Niveaux
                     .Include(s => s.Etudiants)
                     .Include(s => s.Sceances)
                     .Include(s => s.Module_Niveaus)
                     .ThenInclude(i => i.Module)
                     .FirstOrDefaultAsync(m => m.NiveauID == id);

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

            return(RedirectToPage("./Index"));
        }