public ActionResult DeleteEtablissement(ClasseModels model) { using (ClasseRepository repository = new ClasseRepository()) { repository.DeleteById(model.id); repository.Save(); } return(View("Index")); }
public ActionResult EditClasse(ClasseModels model) { using (ClasseRepository repository = new ClasseRepository()) { Classrooms a = repository.GetClasseById(model.id); a.Title = model.title; a.User_Id = model.userId; a.Year_Id = model.yearId; a.Establishment_Id = model.etablissementId; if (ModelState.IsValid) { repository.Save(); } return(RedirectToAction("ReadClasses")); } }
public ActionResult CreateClasse(ClasseModels model) { if (ModelState.IsValid) { using (ClasseRepository repository = new ClasseRepository()) { Classrooms a = new Classrooms { Id = Guid.NewGuid(), Title = model.title, User_Id = model.userId, Year_Id = model.yearId, Establishment_Id = model.etablissementId, }; repository.Add(a); repository.Save(); } return(RedirectToAction("ReadClasses")); } return(View(model)); }