public ActionResult Retest(ProblemRetestViewModel model) { if (model == null) { this.TempData.AddDangerMessage(GlobalResource.Invalid_problem); return(this.RedirectToAction <ProblemsController>(c => c.Index())); } if (!this.CheckIfUserHasContestPermissions(model.ContestId)) { this.TempData.AddDangerMessage(GlobalConstants.NoPrivilegesMessage); return(this.RedirectToAction <ProblemsController>(c => c.Index())); } var problem = this.Data.Problems.GetById(model.Id); if (problem == null) { this.TempData.AddDangerMessage(GlobalResource.Invalid_problem); return(this.RedirectToAction <ProblemsController>(c => c.Index())); } var submissionIds = problem .Submissions .Where(s => !s.IsDeleted) .Select(s => s.Id) .AsEnumerable(); using (var scope = new TransactionScope()) { this.participantScoresData.DeleteAllByProblem(model.Id); this.Data.Context.Submissions .Where(s => !s.IsDeleted && s.ProblemId == problem.Id) .Update(x => new Submission { Processed = false }); this.submissionsForProcessingData.AddOrUpdate(submissionIds); scope.Complete(); } this.TempData.AddInfoMessage(GlobalResource.Problem_retested); return(this.RedirectToAction("Contest", new { id = problem.ContestId })); }
public ActionResult Retest(ProblemRetestViewModel model) { if (model == null || !this.problemsData.ExistsById(model.Id)) { this.TempData.AddDangerMessage(GlobalResource.Invalid_problem); return(this.RedirectToAction <ProblemsController>(c => c.Index())); } if (!this.CheckIfUserHasContestPermissions(model.ContestId)) { this.TempData.AddDangerMessage(GeneralResource.No_privileges_message); return(this.RedirectToAction <ProblemsController>(c => c.Index())); } this.problemsBusiness.RetestById(model.Id); this.TempData.AddInfoMessage(GlobalResource.Problem_retested); return(this.RedirectToAction(c => c.Index(model.ContestId))); }