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()); } }
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()); } }
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()); } }