예제 #1
0
        public async Task <IActionResult> OnPostDeleteAsync()
        {
            if (!await GetModifyAuthorization())
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

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

            try
            {
                await client.DeleteAsync(PostData.Metadata.Id);

                return(RedirectToPage());
            }
            catch
            {
                return(NotFound());
            }
        }
예제 #2
0
        public async Task <IActionResult> OnPostDeleteAsync()
        {
            if (!await CheckModel(false))
            {
                return(BadRequest());
            }
            HttpClient     httpclient = clientFactory.CreateClient();
            ProblemsClient client     = new ProblemsClient(httpclient);

            try
            {
                await client.DeleteAsync(PostData.Metadata.Id);

                return(RedirectToPage("/Problems/Index"));
            }
            catch
            {
                return(NotFound());
            }
        }
예제 #3
0
        public async Task <IActionResult> OnPostDeleteAsync()
        {
            if ((await _authorizationService.AuthorizeAsync(User, Authorizations.Administrator)).Succeeded == false)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            HttpClient     httpclient = clientFactory.CreateClient();
            ProblemsClient client     = new ProblemsClient(httpclient);

            try
            {
                await client.DeleteAsync(PostData.Metadata.Id);

                return(RedirectToPage("/Problems/Index"));
            }
            catch
            {
                return(NotFound());
            }
        }