public ActionResult Author(FormCollection collection) { try { SearchBookBUS bus = new SearchBookBUS(); SearchBookDTO dto = new SearchBookDTO() { Info1 = collection["txtAuthor"], PageNumber = int.Parse(collection["txtPageNum"]), SearchType = SearchType.DETAIL_SEARCH }; int count = bus.SearchBooksByAuthorCount(dto); return View(new SearchResultModels() { Author = int.Parse(collection["txtAuthor"]), Results = bus.SearchBooksByAuthor(dto), NoP = (int) Math.Ceiling((double)count / ((double)Options.NumberOfRecord)), NumberOfResult = count, CurrentPage = dto.PageNumber }); } catch { return View(); } }
public ActionResult Author(int id) { try { SearchBookBUS bus = new SearchBookBUS(); SearchBookDTO dto = new SearchBookDTO() { Info1 = id.ToString(), PageNumber = 1, SearchType = SearchType.DETAIL_SEARCH }; int count = bus.SearchBooksByAuthorCount(dto); return View(new SearchResultModels() { Author = id, Results = bus.SearchBooksByAuthor(dto), NoP = (int) Math.Ceiling((double)count / ((double)Options.NumberOfRecord)), NumberOfResult = count, CurrentPage = dto.PageNumber }); } catch { return View(); } }