public static BookCatalogFilter WithEndDate(this BookCatalogFilter filter, DateTime date) { filter.SetDateEnd(date); return(filter); }
public static BookCatalogFilter WithIsbn(this BookCatalogFilter filter, string isbn) { filter.Isbn = isbn; return(filter); }
public static BookCatalogFilter WithLoanability(this BookCatalogFilter filter, bool canLoan) { filter.Loanable = canLoan; return(filter); }
public static BookCatalogFilter WithTitle(this BookCatalogFilter filter, string title) { filter.Title = title; return(filter); }
public static BookCatalogFilter WithSubject(this BookCatalogFilter filter, string subject) { filter.Subject = subject; return(filter); }
public static BookCatalogFilter WithAuthor(this BookCatalogFilter filter, string author) { filter.Author = author; return(filter); }
public async Task <IEnumerable <Book> > GetPagedBooks(int pageId, int pageSize, BookCatalogFilter filter) { if (pageId < 0) { throw new ArgumentException("Page id cannot be null."); } if (pageSize < 1) { throw new ArgumentException("Page size has to be greater than 0."); } if (filter == null) { throw new ArgumentNullException($"Filter cannot be null."); } var filterMap = _filterMapper.Map(filter); if (filterMap == null) { throw new NullReferenceException("Filter map cannot be null."); } var catalogueItemMaps = await _access.SearchCatalogue(pageId, pageSize, filterMap); if (catalogueItemMaps == null) { throw new NullReferenceException("Catalogue item maps cannot be null."); } return(catalogueItemMaps.Select(catalogueItemMap => _bookCatalogueMapper.Unmap(catalogueItemMap)).ToList()); }