public async Task <IActionResult> ManagePosts(int?page) { var ampvm = new AuthorManagePostsViewModel(); var curUser = await _userManager.GetUserAsync(User); var gbpbauid = new GetBlogPostsByAppUserIdQuery { AppUserId = curUser.Id, CurrentPage = page ?? 1, PageSize = 15 }; ampvm.posts = await _qpa.ProcessAsync(gbpbauid); return(View(ampvm)); }
public async Task <IActionResult> ManagePosts() { AuthorManagePostsViewModel ampvm = new AuthorManagePostsViewModel(); var curUser = await _userManager.GetUserAsync(User); var gbpbauid = new GetBlogPostsByAppUserIdQuery { AppUserId = curUser.Id }; var posts = await _qpa.ProcessAsync(gbpbauid); ampvm.posts = posts; return(View(ampvm)); }
public async Task <IActionResult> ManagePosts() { AuthorManagePostsViewModel ampvm = new AuthorManagePostsViewModel(); var curUser = await _userManager.GetUserAsync(User); var author = await(from u in _context.Users where u.Id == curUser.Id join a in _context.Authors on u.Id equals a.ApplicationUserId select a).FirstOrDefaultAsync(); var posts = await(from bp in _context.BlogPosts where bp.AuthorId == author.Id select bp).ToListAsync(); ampvm.posts = posts; return(View(ampvm)); }