예제 #1
0
 public ActionResult QuestionGridPartialAddNew(NorthOps.Ops.Models.Question item)
 {
     if (ModelState.IsValid)
     {
         try
         {
             unitOfWork.QuestionRepo.Insert(item);
             unitOfWork.Save();
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("_QuestionGridPartial", unitOfWork.QuestionRepo.Get(includeProperties: "Exam")));
 }
예제 #2
0
        public ActionResult QuestionGridPartialUpdate(NorthOps.Ops.Models.Question 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("_QuestionGridPartial", model));
        }