Ejemplo n.º 1
0
        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)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Archive(int pid,
                                                  [FromServices] IArchiveStore archives)
        {
            var arch = await archives.FindInternalAsync(pid);

            return(Window(arch ?? new ProblemArchive {
                ProblemId = pid
            }));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
 public ProblemController(IArchiveStore probs, ISubmissionStore submits)
 {
     Store   = probs;
     Submits = submits;
 }