コード例 #1
0
        public ActionResult ClassesPage()
        {
            ClassSevice    classService = new ClassSevice();
            List <Classes> allClasses   = classService.GetAllClasses();

            return(View(allClasses));
        }
コード例 #2
0
        public ActionResult DeleteClass(int classId)
        {
            ClassSevice classService = new ClassSevice();

            classService.DeleteClass(classId);

            return(RedirectToAction("ClassesPage"));
        }
コード例 #3
0
        public ActionResult AddClass(Classes classes)
        {
            try
            {
                ClassSevice classService = new ClassSevice();
                classService.AddClass(classes);

                return(RedirectToAction("ClassesPage"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #4
0
        public ActionResult StudentRegistration()
        {
            List <SelectListItem> selectListItemsClasses = new List <SelectListItem>();
            ClassSevice           classService           = new ClassSevice();
            List <Classes>        allClasses             = classService.GetAllClasses();

            foreach (Classes classes in allClasses)
            {
                selectListItemsClasses.Add(new SelectListItem()
                {
                    Text = classes.Class, Value = classes.ClassId.ToString()
                });
            }
            ViewBag.Classes = selectListItemsClasses;
            return(View());
        }