Пример #1
0
        public ActionResult insert_grading(FormCollection fc)
        {
            string require_grading = fc["requirements"].ToString();
            string type_grading = fc["type"].ToString();
            double weight_grading = Convert.ToDouble(fc["weight"]); 

            Syllabus_ManagementEntities4 fe = new Syllabus_ManagementEntities4();
            Grading_System d = new Grading_System();

            d.syllabus_FK = 1;
            d.typeOfGrading = type_grading;
            d.weight = weight_grading;
            d.requirementsName = require_grading;  ;

            try
            {
                fe.Grading_System.Add(d);
                fe.SaveChanges();
                ViewBag.Result = "Save Changes";
            }
            catch (Exception e)
            {
                ViewBag.Result = "Error! " + e.Message;
            }
            return RedirectToAction("grading_system", "Teacher");
        }
Пример #2
0
        public ActionResult grading_system()
        {

            Syllabus_ManagementEntities4 grading_system = new Syllabus_ManagementEntities4();
            Grading_System grad_sys = new Grading_System();

            var gradSysList = (from u in grading_system.Grading_System
                               where u.syllabus_FK == 1
                               select u);

            var weight = (from x in grading_system.Grading_System
                          select x).Sum(x => x.weight); 
                        
            ViewBag.Result = weight; 
            ViewData["GradingSystem"] = gradSysList.ToList();


            return View();
        }