예제 #1
0
        public async Task <IActionResult> Description(JuryMarkdownModel model)
        {
            model.Markdown ??= "";
            await Context.SetReadmeAsync(model.Markdown);

            await HttpContext.AuditAsync("updated", $"{Contest.Id}", "description");

            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> Description(
            JuryMarkdownModel model,
            [FromServices] IFileRepository io,
            [FromServices] IMarkdownService md)
        {
            io.SetContext("Problems");
            model.Markdown = model.Markdown ?? "";
            await io.WritePartAsync("c" + Contest.ContestId, "readme.md", model.Markdown);

            await io.WritePartAsync("c" + Contest.ContestId, "readme.html", md.Render(model.Markdown));

            return(View(model));
        }
예제 #3
0
        public async Task <IActionResult> Description(
            int cid, JuryMarkdownModel model,
            [FromServices] IProblemFileRepository io,
            [FromServices] IMarkdownService md)
        {
            model.Markdown ??= "";
            await io.WriteStringAsync($"c{cid}/readme.md", model.Markdown);

            var document = md.Parse(model.Markdown);
            await io.WriteStringAsync($"c{cid}/readme.html", md.RenderAsHtml(document));

            await HttpContext.AuditAsync("updated", $"{cid}", "description");

            return(View(model));
        }