public async Task <ActionResult> Index(string notebookid)
        {
            var repository = new NotebookRepository();

            var notebook = await repository.GetNotebookSections(notebookid);

            ViewBag.CurrentNotebookTitle = notebook.Name; ViewBag.CurrentNotebookId = notebook.Id;

            return(View(notebook.Sections.OrderBy(s => s.Name).ToList()));
        }
Beispiel #2
0
        public async Task <ActionResult> Index(string notebookid)
        {
            // Get an access token for the request.
            string            userObjId  = System.Security.Claims.ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
            SessionTokenCache tokenCache = new SessionTokenCache(userObjId, HttpContext);
            string            authority  = string.Format(ConfigurationManager.AppSettings["ida:AADInstance"], "common", "");

            AuthHelper authHelper  = new AuthHelper(authority, ConfigurationManager.AppSettings["ida:AppId"], ConfigurationManager.AppSettings["ida:AppSecret"], tokenCache);
            string     accessToken = await authHelper.GetUserAccessToken("/Section/Index");

            // Make the request.
            var repository = new NotebookRepository(accessToken);
            var notebook   = await repository.GetNotebookSections(notebookid);

            ViewBag.CurrentNotebookTitle = notebook.Name; ViewBag.CurrentNotebookId = notebook.Id;

            return(View(notebook.Sections.OrderBy(s => s.Name).ToList()));
        }