public ActionResult Question(string QuestionId) { ModelContainer data = new ModelContainer(); Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO(); Res r = tdao.ReadQuastions(quastion => quastion.QuastionId.ToString() == QuestionId, data); if (r.Success) { Models.Quastion quastion = (r.Value as IEnumerable<Test.Models.Quastion>).First(); return View(quastion); } else return RedirectToAction("Errors", "Shared"); }
public ActionResult CreateVariant(string QuestionId, string VariantText, bool isValid) { ModelContainer data = new ModelContainer(); Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO(); Res r0 = tdao.ReadQuastions(question => question.QuastionId.ToString() == QuestionId, data); Models.Quastion q = null; if (r0.Success) { q = (r0.Value as IEnumerable<Test.Models.Quastion>).First(); } Res r = tdao.CreateVariant(q, VariantText, isValid, data); if (r.Success && r0.Success) { return RedirectToAction("Test", "Lector", new { TestId = q.Test_TestId }); } else return RedirectToAction("Errors", "Shared"); }
public ActionResult DeleteQuestion(string QuestionId) { ModelContainer data = new ModelContainer(); Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO(); Res r0 = tdao.ReadQuastions(question => question.QuastionId.ToString() == QuestionId, data); string TestId = ""; if (r0.Success) { TestId = (r0.Value as IEnumerable<Models.Quastion>).First().Test_TestId.ToString(); } Res r1 = tdao.DeleteQuastions(question => question.QuastionId.ToString() == QuestionId, data); if (r1.Success && r0.Success) { return RedirectToAction("Test", "Lector", new { TestId = TestId }); } else return RedirectToAction("Errors", "Shared"); }