public ActionResult Program(string id, string contest, ProblemProgramModel model) { if (!ModelState.IsValid) return View(model); try { Problem problem = Contest.ByName(contest).ProblemByName(id); problem.Comparer = model.Spj; problem.DataChecker = model.Std; problem.DataCheckerLanguage = model.StdLanguage; problem.ComparerLanguage = model.SpjLanguage; problem.Change(); } catch (ContestNotFoundException) { return RedirectToAction("Error", "Shared", new { msg = "找不到相关比赛" }); } catch (ProblemNotFoundException) { return RedirectToAction("Error", "Shared", new { msg = "找不到相关题目" }); } return RedirectToAction("Complete", new { id = id, contest = contest }); }
public ActionResult Program(string id, string contest) { ProblemProgramModel model = new ProblemProgramModel { Contest = contest, Problem = id }; try { Problem problem = Contest.ByName(contest).ProblemByName(id); model.Spj = problem.Comparer; model.Std = problem.DataChecker; model.SpjLanguage = problem.ComparerLanguage.Value; model.StdLanguage = problem.DataCheckerLanguage.Value; } catch (ContestNotFoundException) { return RedirectToAction("Error", "Shared", new { msg = "找不到相关比赛" }); } catch (ProblemNotFoundException) { return RedirectToAction("Error", "Shared", new { msg = "找不到相关题目" }); } return View(model); }