protected override void Initialize(System.Web.Routing.RequestContext requestContext) { this.currentUser = this.store.CurrentUser(); base.Initialize(requestContext); }
public static async Task<Blog> FromUserAsync(UserProfile user) { if (string.IsNullOrWhiteSpace(user.BlogName) || string.IsNullOrWhiteSpace(user.DropboxAccessToken)) { return null; } using (var client = new DropboxClient(user.DropboxAccessToken, userAgent: "SimpleBlogDemo")) { return new Blog { BlogName = user.BlogName, BlogArticles = new List<ArticleMetadata>(await client.GetArticleList()).AsReadOnly() }; } }
public async Task<ActionResult> ProfileAsync(UserProfile profile) { if (this.currentUser.ID != profile.ID) { return this.RedirectToAction("Index"); } this.currentUser.BlogName = profile.BlogName; await this.store.SaveChangesAsync(); return View(this.currentUser); }