/// <summary> /// Creates URL to receive top/new books. /// </summary> /// <param name="category">books category (top/news)</param> /// <param name="limit">number of results</param> /// <param name="offset">number of skipped results</param> /// <returns>URL to receive top/new books</returns> private string CreateBookListURL(BookListCategory category, uint limit, uint offset ) { return string.Format("http://{0}/api/books/list?category={1}",//&limit={2}&offset={3}", ServerAddress, BookListCategoryToStringDictionary[category]); }
/// <summary> /// Sends request to receive books of specified category. /// </summary> /// <param name="category">books category</param> /// <param name="limit">number of results</param> /// <param name="offset">number of skipped results</param> /// <returns>books of specified category</returns> public async Task<IEnumerable<Book>> GetBooksByCategory(BookListCategory category, uint limit, uint offset) { if (!BookListCategoryToStringDictionary.ContainsKey(category)) throw new ArgumentException("category"); string url = CreateBookListURL(category, limit, offset); var books = await RequestManager.DownloadDataAsync<IEnumerable<Book>>(url); return books; }
public ServerBooksViewModel(BookListCategory category) { this.BooksCategory = category; }