public ActionResult Index(int?categoryId) { BooksManager manager = new BooksManager(Properties.Settings.Default.ConStr); IndexViewModel viewModel = new IndexViewModel(); viewModel.Books = manager.GetBooks(categoryId); viewModel.Categories = manager.GetCategories(); viewModel.CurrentCategoryId = categoryId; if (TempData["message"] != null) { viewModel.Message = (string)TempData["message"]; } return(View(viewModel)); }
public async Task <IActionResult> Get() { List <Book> books = await booksManager.GetBooks(); return(Ok(books)); }