예제 #1
0
 public ActionResult DeleteEtablissement(ClasseModels model)
 {
     using (ClasseRepository repository = new ClasseRepository())
     {
         repository.DeleteById(model.id);
         repository.Save();
     }
     return(View("Index"));
 }
예제 #2
0
        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"));
            }
        }
예제 #3
0
        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));
        }