Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ namespace LibraryManagement.Api.Brokers.Storages
public partial interface IStorageBroker
{
ValueTask<Reader> InsertReaderAsync(Reader reader);
IQueryable<Reader> SelectAllReaders();
ValueTask<Reader> SelectReaderByIdAsync(Guid readerId);
}
}
12 changes: 12 additions & 0 deletions LibraryManagement.Api/Brokers/Storages/StorageBroker.Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,17 @@

public async ValueTask<Reader> InsertReaderAsync(Reader reader) =>
await InsertAsync(reader);

public IQueryable<Reader> SelectAllReaders() =>
SelectAll<Reader>().Include(readers => readers.Books);

public async ValueTask<Reader> SelectReaderByIdAsync(Guid readerId)
{
var readerWithBooks = await SelectAll<Reader>()
.Include(reader => reader.Books)
.FirstOrDefaultAsync(c => c.ReaderId == readerId);

return readerWithBooks;

Check warning on line 27 in LibraryManagement.Api/Brokers/Storages/StorageBroker.Reader.cs

View workflow job for this annotation

GitHub Actions / Build

Possible null reference return.
}
}
}
Loading