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 async Task <IActionResult> AllBookById(int cid) { 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 = await serviceBook.GetAllBookById(cid); return(View(AllBookList)); }