Beispiel #1
0
 public async Task <ActionResult> QuestionGridPartialAddNew(NorthOps.Ops.Models.Question item)
 {
     if (ModelState.IsValid)
     {
         try
         {
             item.QuestionId = Guid.NewGuid();
             unitOfWork.QuestionRepo.Insert(item);
             await unitOfWork.SaveAsync();
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     ViewBag.ExamId = item.ExamId;
     return(PartialView("_QuestionGridPartial", unitOfWork.QuestionRepo.Get(filter: m => m.ExamId == item.ExamId)));
 }
Beispiel #2
0
        public async Task <ActionResult> QuestionGridPartialUpdate(NorthOps.Ops.Models.Question item)
        {
            var model = new object[0];

            if (ModelState.IsValid)
            {
                try
                {
                    unitOfWork.QuestionRepo.Update(item);
                    await unitOfWork.SaveAsync();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            ViewBag.ExamId = item.ExamId;
            return(PartialView("_QuestionGridPartial", unitOfWork.QuestionRepo.Get(filter: m => m.ExamId == item.ExamId)));
        }