Exemple #1
0
        public async Task <IActionResult> ChangeExpected(int pid, int sid, ChangeExpectedModel model)
        {
            var it = await Submissions.FindAsync(sid);

            if (it == null || it.ProblemId != pid)
            {
                return(NotFound());
            }

            it.ExpectedResult = model.Verdict == -1 ? default(Verdict?) : (Verdict)model.Verdict;
            it.Language       = model.Language;
            await Submissions.UpdateAsync(it);

            return(RedirectToAction(nameof(Detail)));
        }
        public async Task <IActionResult> ChangeExpected(int pid, int sid, ChangeExpectedModel model)
        {
            var it = await SubmissionManager.Submissions
                     .Where(s => s.SubmissionId == sid && s.ProblemId == pid)
                     .FirstOrDefaultAsync();

            if (it == null)
            {
                return(NotFound());
            }

            it.ExpectedResult = model.Verdict == -1 ? default(Verdict?) : (Verdict)model.Verdict;
            await SubmissionManager.UpdateAsync(it);

            return(RedirectToAction(nameof(Detail)));
        }