public ActionResult ExamGridPartialUpdate(NorthOps.Ops.Models.Exam item)
 {
     if (ModelState.IsValid)
     {
         try
         {
             unitOfWork.ExamRepo.Update(item);
             unitOfWork.Save();
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("_ExamGridPartial", unitOfWork.ExamRepo.Get()));
 }
Exemple #2
0
        public ActionResult ExamsGridPartialUpdate(NorthOps.Ops.Models.Exam item)
        {
            var model = new object[0];

            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_ExamsGridPartial", model));
        }
 public ActionResult ExamGridPartialAddNew(NorthOps.Ops.Models.Exam item)
 {
     item.DateCreated = DateTime.Now;
     item.ExamId      = Guid.NewGuid();
     if (ModelState.IsValid)
     {
         try
         {
             unitOfWork.ExamRepo.Insert(item);
             unitOfWork.Save();
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("_ExamGridPartial", unitOfWork.ExamRepo.Get()));
 }