source: ChapterX.Infrastructure/Repositories/ReadingListRepository.cs@ acf690c

main
Last change on this file since acf690c was acf690c, checked in by kikisrbinoska <srbinoskakristina07@…>, 4 months ago

Added fixes for the login,stories management and reading lists

  • Property mode set to 100644
File size: 1016 bytes
Line 
1using ChapterX.Domain.Entities;
2using ChapterX.Domain.Repositories;
3using ChapterX.Infrastructure.Data.DataContext;
4using Microsoft.EntityFrameworkCore;
5
6namespace ChapterX.Infrastructure.Repositories
7{
8 public class ReadingListRepository : GenericRepository<ReadingList>, IReadingListRepository
9 {
10 public ReadingListRepository(ApplicationDbContext context) : base(context)
11 {
12 }
13
14 public override async Task<IEnumerable<ReadingList>> GetAllAsync(CancellationToken cancellationToken = default)
15 {
16 return await _dbSet
17 .Include(r => r.ReadingListItems)
18 .ToListAsync(cancellationToken);
19 }
20
21 public async Task<IEnumerable<ReadingList>> GetByUserIdAsync(int userId, CancellationToken cancellationToken = default)
22 {
23 return await _dbSet
24 .Where(r => r.UserId == userId)
25 .Include(r => r.ReadingListItems)
26 .ToListAsync(cancellationToken);
27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.