예제 #1
0
        public ActionResult GradeGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] MurongEnrollment.Models.Grades item)
        {
            //var model = new object[0];
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                    unitOfWork.GradesRepo.Update(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var EnrollmentId = Request.Params["EnrollmentId"];
            var GradingId    = Request.Params["GradingId"];

            ViewBag.EnrollmentId = EnrollmentId;
            List <Grades> model = unitOfWork.GradesRepo.Get(m => m.EnrolledSubjects.EnrollmentId == EnrollmentId && m.GradingId == GradingId).ToList();

            return(PartialView("_GradeGridViewPartial", model));
        }
예제 #2
0
        public ActionResult GradeGridViewPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] MurongEnrollment.Models.Grades item)
        {
            if (item != null)
            {
                try
                {
                    // Insert here a code to delete the item from your model
                    unitOfWork.GradesRepo.Delete(unitOfWork.GradesRepo.Find(m => m.Id == item.Id));
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            var EnrollmentId = Request.Params["EnrollmentId"];
            var GradingId    = Request.Params["GradingId"];

            ViewBag.EnrollmentId = EnrollmentId;
            List <Grades> model = unitOfWork.GradesRepo.Get(m => m.EnrolledSubjects.EnrollmentId == EnrollmentId && m.GradingId == GradingId).ToList();

            return(PartialView("_GradeGridViewPartial", model));
        }