コード例 #1
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));
        }