public async Task <IActionResult> OnGetAsync(long id) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar == null) { return(NotFound()); } Folders = await _context.Folders .Where(f => f.ClubId == id) .Where(f => f.ParentFolderId == null) .Select(f => new FolderCard { Id = f.Id, Name = f.Name, Slug = f.Slug, Description = f.Description, ClubId = f.ClubId, StoriesCount = f.StoriesCount, ChildFolders = f.ChildFolders.Select(cf => new FolderMinimalDto { Id = cf.Id, Name = cf.Name, Slug = cf.Slug }) }) .AsNoTracking() .ToListAsync(); return(Page()); }
public async Task <IActionResult> OnGetAsync(long id, string?slug) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar is null) { return(NotFound()); } ThreadCards = await _context.ClubThreads .Where(ct => ct.ClubId == id) .OrderByDescending(ct => ct.CreationDate) .Take(3) .Select(ct => new ThreadCard { Id = ct.Id, Title = ct.Title, ClubId = ct.ClubId, IsPinned = ct.IsPinned, CreationDate = ct.CreationDate, AuthorName = ct.Author.UserName, AuthorAvatar = ct.Author.Avatar, CommentsCount = ct.CommentsThread.Comments.Count }) .ToListAsync(); return(Page()); }
public async Task <IActionResult> OnGetAsync(long id) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar == null) { return(NotFound()); } ThreadCards = await _threadRepo.GetThreadCards(id, 3); return(Page()); }
public async Task <IActionResult> OnGetAsync(long id) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar == null) { return(NotFound()); } ClubMembers = await _clubRepo.GetMembers(id, 1, 100); return(Page()); }
public async Task <IActionResult> OnGetAsync(long id) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar == null) { return(NotFound()); } Folders = await _foldersRepo.GetClubFolderCards(id); return(Page()); }
public async Task <IActionResult> OnGetAsync(long clubId, long threadId) { ClubBar = await _clubRepo.GetClubBar(clubId); if (ClubBar == null) { return(NotFound()); } ClubThread = await _threadRepo.GetThreadDetails(threadId); if (ClubThread == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(long id) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar is null) { return(NotFound()); } ClubMembers = await _context.ClubMembers .Where(cm => cm.ClubId == id) .Select(cm => cm.Member) .Paginate(1, 50) .ProjectTo <UserCard>(_mapper.ConfigurationProvider) .AsNoTracking() .ToListAsync(); return(Page()); }
public async Task <IActionResult> OnGetAsync(long id, [FromQuery] int page = 1) { ClubBar = await _clubRepo.GetClubBar(id); if (ClubBar is null) { return(NotFound()); } var query = _context.ClubThreads .Where(ct => ct.ClubId == id); ThreadCards = await query .OrderByDescending(ct => ct.IsPinned) .ThenByDescending(ct => ct.CreationDate) .Paginate(page, _config.ClubThreadsPerPage) .Select(ct => new ThreadCard { Id = ct.Id, Title = ct.Title, ClubId = ct.ClubId, IsPinned = ct.IsPinned, CreationDate = ct.CreationDate, AuthorName = ct.Author.UserName, AuthorAvatar = ct.Author.Avatar, CommentsCount = ct.CommentsThread.Comments.Count }) .ToListAsync(); Pagination = new Pagination { ItemCount = await query.CountAsync(), CurrentPage = page, PerPage = _config.ClubThreadsPerPage }; return(Page()); }
public async Task <IActionResult> OnGetAsync(long clubId, long id, [FromQuery] int page = 1) { var uid = User.GetNumericId(); ClubBar = await _clubRepo.GetClubBar(clubId); if (ClubBar == null) { return(NotFound()); } Folder = await _foldersRepo.GetFolder(id); if (Folder == null) { return(NotFound()); } EditPermitted = await _clubRepo.CheckRoles(Folder.Id, uid, new[] { EClubMemberRoles.Founder, EClubMemberRoles.Admin }); Stories = await _storiesRepo.GetPaginatedCardsOfFolder(id, page, _config.StoriesPerPage); // Prepare pagination Pagination = new Pagination { PerPage = _config.StoriesPerPage, ItemCount = Folder.StoriesCount, CurrentPage = page }; return(Page()); }