public async Task <IActionResult> Index(int id) { List <Book> AllBookList; try { log.LogInformation("Executing GetBooks method"); log.LogInformation("This is a Test Message"); } catch (Exception e) { log.LogCritical(e.Message); log.LogInformation("Executed GetBooks Method.."); } ViewData["Categories"] = serviceBook.SelectCategory(); if (id > 0) { AllBookList = await serviceBook.GetAllBookById(id); return(View(AllBookList)); } else { AllBookList = await serviceBook.GetAllBooks(); return(View(AllBookList)); } }
public IActionResult Index() { try { log.LogInformation("Executing GetBooks method"); log.LogInformation("This is a Test Message"); } catch (Exception e) { log.LogCritical(e.Message); log.LogInformation("Executed GetBooks Method.."); } List <Book> AllBookList = serviceBook.GetAllBooks(); return(View(AllBookList)); }
public IActionResult Index() { try { log.LogInformation("Executing GetBooks method"); log.LogInformation("This is a Test Message"); } catch (Exception e) { log.LogCritical(e.Message); log.LogInformation("Executed GetBooks Method.."); } //var resultlist = serviceBook.SelectCategory(); //SelectList list = new SelectList(resultlist, "CategoryId", "CategoryTitle"); ViewData["Categories"] = serviceBook.SelectCategory(); List <Book> AllBookList = serviceBook.GetAllBooks(); return(View(AllBookList)); }