public override object Get() { var typeControl = H.l(LabelFor(x => x.Type), SelectFor(x => x.Type, NamedIdCache <TestQuestionType> .List, x => x.Name, x => x.Id)); if (Model.Id > 0) { typeControl = H.l(LabelFor(x => x.Type), div.Class("editor-div")[ TestQuestionType.GetName(Model.Type)], HiddenFor(x => x.Type)); } return(l( Tabs(_.List("Вопрос", "Файл"), AjaxForm(Url.Action <TestEditController>(x => x.EditQuestion(null)))[ HiddenFor(x => x.Id), HiddenFor(x => x.TestId), ControlFor(x => x.Description), typeControl, Select2For(Model.TestModule.GetOrDefault(x => x.Name), x => x.ModuleId, Url.Action <TestEditController>(c => c.GetModulesAuto(Model.TestId, null))), SaveButton() ], TestControls.TestFileUpload(TestControls.QuestionFileView(Model.Id, true), Url.Action <TestEditController>(c => c.UploadQuestionFile(Model.Id, null)), Url.Action <TestEditController>(c => c.DeleteQuestionFile(Model.Id)), Url.Action <TestEditController>(c => c.GetQuestionFileControl(Model.Id)), Model.Id == 0 )))); }
public override object Get() { object answerControl = null; switch (Model.TestQuestion.Type) { case TestQuestionType.OneAnswer: case TestQuestionType.ManyAnswers: answerControl = ControlFor(x => x.IsRight); break; case TestQuestionType.Comparison: answerControl = Select2For(Model.ComparableAnswer.GetOrDefault(x => x.Description), x => x.ComparableId, Url.Action <TestEditController>(c => c.GetAnswersAuto(Model.TestQuestion.Id, null))); break; case TestQuestionType.Sort: answerControl = ControlFor(x => x.Sort); break; default: throw new Exception("TestQuestionType out of range"); } return(l( Tabs(_.List("�עגוע", "�איכ"), AjaxForm(Url.Action <TestEditController>(x => x.EditAnswer(null)))[ HiddenFor(x => x.Id), HiddenFor(x => x.QuestionId), ControlFor(x => x.Description), answerControl, SaveButton() ], TestControls.TestFileUpload(TestControls.AnswerFileView(Model.Id, true), Url.Action <TestEditController>(c => c.UploadAnswerFile(Model.Id, null)), Url.Action <TestEditController>(c => c.DeleteAnswerFile(Model.Id)), Url.Action <TestEditController>(c => c.GetAnswerFileControl(Model.Id)), Model.Id == 0 )) )); }