Beispiel #1
0
        public ActionResult GridViewPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] MurongEnrollment.Models.Subjects item)
        {
            if (item != null)
            {
                try
                {
                    var subject = unitOfWork.SubjectRepo.Find(m => m.Id == item.Id);
                    unitOfWork.SubjectRepo.Delete(subject);
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            var model = unitOfWork.SubjectRepo.Get();

            return(PartialView("_GridViewPartial", model));
        }
Beispiel #2
0
        public ActionResult GridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] MurongEnrollment.Models.Subjects item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    unitOfWork.SubjectRepo.Update(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model = unitOfWork.SubjectRepo.Get();

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