public JsonResult TestAnswer(string id, string answer) { ExamPages proble = testproblemRepository.Getproblem(int.Parse(id)); return(Json(proble, JsonRequestBehavior.AllowGet)); }
public ActionResult AddExamPageType(int?id, FormCollection collection, string alertMessage, string _Shop, string IsEdit, string ETypeid) { ExamPages _examType = new ExamPages(); try { if (IsEdit == "1") { var examEdit = examPagesRepository.GetByDatabaseID(id.Value); TryUpdateModel(examEdit, collection); if (ETypeid.IsNotNullAndEmpty()) { examEdit.ETypeID = examTypeRepository.GetByDatabaseID(Convert.ToInt32(ETypeid)); } examPagesRepository.Update(examEdit); ViewData["alertMessage"] = "修改成功!"; return(View("AddExamPageType")); } else { TryUpdateModel(_examType, collection); var examType1 = examTypeRepository.GetByDatabaseID(Convert.ToInt32(ETypeid)); _examType.ETypeID = examType1; if (_Shop.IsNotNullAndEmpty()) { _examType._Shop = shopRepository.GetShopByShopName(_Shop); } if (examPagesRepository.ExistExamPageName(_examType.Title)) { ViewData["alertMessage"] = "添加失败 此标题已存在!"; return(View(_examType)); } examPagesRepository.Save(_examType); } alertMessage = "操作成功!"; ViewData["alertMessage"] = alertMessage; return(View("AddExamPageType", _examType)); } catch (RuleException ex) { throw new RuleException(ex.Message, ex); } }