public async Task <IActionResult> Archive( int pid, ProblemArchive model, [FromServices] IArchiveStore archives) { var arch = await archives.FindInternalAsync(pid); if (arch == null) { try { model.TagName ??= ""; model.ProblemId = pid; await archives.CreateAsync(model); StatusMessage = $"Problem published as {model.PublicId}."; } catch (Exception ex) { StatusMessage = ex.Message; } } else { arch.TagName = model.TagName; await archives.UpdateAsync(arch); StatusMessage = "Problem tag updated."; } return(RedirectToAction(nameof(Overview))); }
public async Task <IActionResult> Archive(int pid, [FromServices] IArchiveStore archives) { var arch = await archives.FindInternalAsync(pid); return(Window(arch ?? new ProblemArchive { ProblemId = pid })); }
public async Task <IActionResult> Overview(int pid, [FromServices] ITestcaseStore tcs, [FromServices] IArchiveStore archs, [FromServices] IProblemsetStore cps) { ViewBag.TestcaseCount = await tcs.CountAsync(Problem); ViewBag.Archive = await archs.FindInternalAsync(pid); ViewBag.Contests = await cps.ListByProblemAsync(pid); ViewBag.Users = await Problems.ListPermittedUserAsync(pid); return(View(Problem)); }
public ProblemController(IArchiveStore probs, ISubmissionStore submits) { Store = probs; Submits = submits; }