Beispiel #1
0
        public async Task <IActionResult> OnPostCreateTestAsync()
        {
            if ((await GetModifyAuthorization()) == false)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                ShowId = PostData.TestCaseId;
                if (await GetData(PostData.ProblemId))
                {
                    return(Page());
                }
                else
                {
                    return(NotFound());
                }
            }

            HttpClient     httpclient = clientFactory.CreateClient();
            ProblemsClient client     = new ProblemsClient(httpclient);

            try
            {
                TestCaseMetadata tmeta = await client.CreateTestAsync(PostData.ProblemId, PostData.TestCase);

                return(RedirectToPage(new { id = PostData.ProblemId, showId = tmeta.Id }));
            }
            catch
            {
                return(NotFound());
            }
        }