public async Task <IActionResult> OnGet(long clubId, long id) { var uid = User.GetNumericId(); if (uid == null) { return(Unauthorized()); } // Check if founder var isFounder = await _clubRepo.CheckRoles(clubId, (long)uid, new[] { EClubMemberRoles.Founder, EClubMemberRoles.Admin }); if (!isFounder) { return(Unauthorized()); } Folder = await _context.Folders .Where(f => f.ClubId == clubId) .Where(f => f.Id == id) .AsNoTracking() .FirstOrDefaultAsync(); if (Folder == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGet(long clubId, long id) { ClubId = clubId; var uid = User.GetNumericId(); if (uid == null) { return(Unauthorized()); } // Check if founder or admin var isFounder = await _clubRepo.CheckRoles(clubId, (long)uid, new[] { EClubMemberRoles.Founder, EClubMemberRoles.Admin }); if (!isFounder) { return(Unauthorized()); } var folder = await _context.Folders .Where(f => f.ClubId == clubId) .Where(f => f.Id == id) .AsNoTracking() .FirstOrDefaultAsync(); if (folder == null) { return(NotFound()); } Input = new InputModel { Id = folder.Id, Name = folder.Name, Description = folder.Description, ParentId = folder.ParentFolderId, Role = folder.AccessLevel }; return(Page()); }
public async Task <IActionResult> OnGet(long clubId) { ClubId = clubId; var uid = User.GetNumericId(); if (uid == null) { return(Unauthorized()); } // Check if founder var isFounder = await _clubRepo.CheckRoles(clubId, (long)uid, new[] { EClubMemberRoles.Founder, EClubMemberRoles.Admin }); if (!isFounder) { return(Unauthorized()); } 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()); }