December 2019
Intermediate to advanced
510 pages
11h 33m
English
Another step we can take to extend our web service project with the related entities is to implement two new methods to retrieve the items related to an artist or a genre in the IItemRepository interface: the GetItemsByArtistIdAsync and GetItemsByGenreIdAsync methods. Both of these methods can be used by the GET /api/artists/{id}/items and GET /api/genre/{id}/items routes to retrieve the items.
Let's proceed by adding the following methods to the IItemsRepository interface and implementing them in the corresponding implementation:
//Repositories/IItemRepository.cs public interface IItemRepository : IRepository { ... Task<IEnumerable<Item>> GetItemByArtistIdAsync(Guid id); Task<IEnumerable<Item>> ...