コード例 #1
0
 public ActionResult Variant(string VariantId)
 {
     ModelContainer data = new ModelContainer();
     Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
     Res r = tdao.ReadVariants(variant => variant.VariantId.ToString() == VariantId, data);
     if (r.Success)
     {
         Models.Variant variant = (r.Value as IEnumerable<Test.Models.Variant>).First();
         return View((r.Value as IEnumerable<Test.Models.Variant>).First());
     }
     else
         return RedirectToAction("Errors", "Shared");
 }
コード例 #2
0
 public ActionResult DeleteVariant(string VariantId)
 {
     ModelContainer data = new ModelContainer();
     Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
     Res r0 = tdao.ReadVariants(variant => variant.VariantId.ToString() == VariantId, data);
     Models.Variant v = null;
     string TestId = "";
     if (r0.Success)
     {
         v = (r0.Value as IEnumerable<Test.Models.Variant>).First();
         TestId = v.Quastion.Test_TestId.ToString();
     }
     Res r = tdao.DeleteVariant(variant => variant.VariantId.ToString() == VariantId, data);
     if (r.Success && r0.Success)
     {
         return RedirectToAction("Test", "Lector", new { TestId = TestId });
     }
     else
         return RedirectToAction("Errors", "Shared");
 }