Exemple #1
0
        public async Task <IActionResult> OnPostEditTestAsync()
        {
            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
            {
                await client.UpdateTestAsync(PostData.ProblemId, PostData.TestCaseId, PostData.TestCase);

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