public async Task <bool> EditBookCategoryAsync(Models.BookCategory BookCategory) { HttpClient client = HttpClients.GetInstance(); HttpResponseMessage response = await client.PutAsJsonAsync("bookcategories/update", BookCategory); if (!response.IsSuccessStatusCode) { return(false);; } return(true); }
public async Task <Models.BookCategory> GetBookCategoryAsync(int BookCategoryID) { HttpClient client = HttpClients.GetInstance(); Models.BookCategory bookCategory = null; HttpResponseMessage response = await client.GetAsync("bookcategories/getbyid/" + BookCategoryID); if (response.IsSuccessStatusCode) { bookCategory = await response.Content.ReadAsAsync <Models.BookCategory>(); } return(bookCategory); }
public bool AddBookCategory(string bookCategoryName) { Models.BookCategory bookCategory = new Models.BookCategory(); bookCategory.BookCategoryName = bookCategoryName; try { using (BookLibraryContext db = new BookLibraryContext()) { db.BookCategories.Add(bookCategory); db.SaveChanges(); } } catch (Exception exc) { return(false); } return(true); }
public IList <Book> GetBooksByCategory(Models.BookCategory bookCategory) { throw new NotImplementedException(); }