// 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(Salle).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalleExists(Salle.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() { if (!ModelState.IsValid) { AnneUId = _context.AnneeUniversitaires.Where(x => x.AnneeCourante == true).FirstOrDefault().ID; return(Page()); } try{ var result = await _context.Niveaux.AddAsync(Niveau); await _context.SaveChangesAsync(); AnneUId = _context.AnneeUniversitaires.Where(x => x.AnneeCourante == true).FirstOrDefault().ID; return(RedirectToPage("./Index", new { id = Niveau.AnneeUniversitaireId })); } catch (DbUpdateException e) { AnneUId = _context.AnneeUniversitaires.Where(x => x.AnneeCourante == true).FirstOrDefault().ID; ErrorMessage = "Niveau déjà existant"; return(Page()); } }
// 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) { var groupe = _context.Groupes.Where(x => x.ID == groupeId).FirstOrDefault(); var matieres = (from x in _context.FiliereMatieres join y in _context.Matieres on x.MatiereId equals y.ID where x.FiliereId == groupe.FiliereId select new{ ID = x.ID, NomMat = y.Libelle }).ToList(); ViewData["FiliereMatiereId"] = new SelectList(matieres, "ID", "NomMat"); var salles = (from x in _context.Salles join y in _context.EcoleSites on x.EcoleSiteId equals y.ID select new { ID = x.ID, Libelle = x.Libelle + " - " + y.Libelle }).ToList(); ViewData["SalleId"] = new SelectList(salles, "ID", "Libelle"); return(Page()); } _context.Seances.Add(Seance); await _context.SaveChangesAsync(); return(RedirectToPage("./Index", new { id = Seance.GroupeId })); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } AnneeUniversitaire = await _context.AnneeUniversitaires.FindAsync(id); if (AnneeUniversitaire != null) { if (_context.AnneeUniversitaires.Count() == 1) { return(Page()); } if (AnneeUniversitaire.AnneeCourante == true) { var nvanneecourante = _context.AnneeUniversitaires.Where(x => x.ID != AnneeUniversitaire.ID).FirstOrDefault(); nvanneecourante.AnneeCourante = true; _context.SaveChanges(); } _context.AnneeUniversitaires.Remove(AnneeUniversitaire); 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() { if (!ModelState.IsValid) { return(Page()); } _context.FiliereMatieres.Add(FiliereMatiere); await _context.SaveChangesAsync(); return(RedirectToPage("./Index", new { id = FiliereMatiere.FiliereId })); }
// 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.Salles.Add(Salle); 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() { if (!ModelState.IsValid) { return(Page()); } AnneeUniversitaire.AnneeCourante = false; _context.AnneeUniversitaires.Add(AnneeUniversitaire); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(AnneeUniversitaire).State = EntityState.Modified; try { if (AnneeUniversitaire.AnneeCourante == true) { foreach (var annee in _context.AnneeUniversitaires) { if (annee.ID != AnneeUniversitaire.ID) { annee.AnneeCourante = false; } } } else { AnneeUniversitaire.AnneeCourante = true; statusmsg = "Veuillez choisir une autre année courante"; return(Page()); } await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnneeUniversitaireExists(AnneeUniversitaire.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } FiliereMatiere = await _context.FiliereMatieres.FindAsync(id); if (FiliereMatiere != null) { _context.FiliereMatieres.Remove(FiliereMatiere); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } AppUser = await _context.AppUSers.FindAsync(id); if (AppUser != null) { _context.AppUSers.Remove(AppUser); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Groupe = await _context.Groupes.FindAsync(id); if (Groupe != null) { _context.Groupes.Remove(Groupe); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index", new { id = Groupe.FiliereId })); }
// 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()); } idfiliere = Groupe.FiliereId; try{ _context.Groupes.Add(Groupe); await _context.SaveChangesAsync(); return(RedirectToPage("./Index", new { id = Groupe.FiliereId })); }catch { erreurmessage = "Ce groupe existe déja"; return(Page()); } }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Inscription = await _context.Inscriptions.FindAsync(id); var grid = Inscription.GroupeId; if (Inscription != null) { _context.Inscriptions.Remove(Inscription); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index", new { id = grid })); }
// 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()); } try{ Inscription.AnneeUniversitaireId = _context.AnneeUniversitaires.Where(x => x.AnneeCourante == true) .FirstOrDefault().ID; _context.Inscriptions.Add(Inscription); await _context.SaveChangesAsync(); return(RedirectToPage("./Index", new { id = Inscription.GroupeId })); }catch { statusmsg = "Etudiants Existe déja dans un autre groupe!"; } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { int idannee; if (id == null) { return(NotFound()); } Niveau = await _context.Niveaux.FindAsync(id); idannee = Niveau.AnneeUniversitaireId; if (Niveau != null) { _context.Niveaux.Remove(Niveau); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index", new{ id = idannee })); }