public async Task <ActionResult> Delete(string id) { var repository = new NotebookRepository(); if (id != null) { await repository.DeletePage(id); } return(Redirect("/")); }
public async Task <ActionResult> Delete(string id) { // Get an access token for the request. string userObjId = AuthHelper.GetUserId(System.Security.Claims.ClaimsPrincipal.Current); SessionTokenCache tokenCache = new SessionTokenCache(userObjId, HttpContext); string authority = string.Format(ConfigurationManager.AppSettings["ida:AADInstance"], "common", "/v2.0"); AuthHelper authHelper = new AuthHelper(authority, ConfigurationManager.AppSettings["ida:AppId"], ConfigurationManager.AppSettings["ida:AppSecret"], tokenCache); string accessToken = await authHelper.GetUserAccessToken("/Page/Delete"); // Make the request. var repository = new NotebookRepository(accessToken); if (id != null) { await repository.DeletePage(id); } return(Redirect("/")); }