public ActionResult Index(string id) { try { int Id = 0; int.TryParse(id, out Id); Id = Id == 0 ? Id : 1; if (Id == 0) { Session["keyword"] = ""; } string searchBy = ""; string keyword = ""; var orderBy = Common.defaultOrderBy; var order = Common.defaultListOrder; var _pageNo = 1; var _pageSize = 10; var _pageStatus = 1; var totalRecords = 0; var dtodiagnosiss = diagnosisRepository.Search(searchBy, keyword, orderBy, order, _pageNo, _pageSize, out totalRecords); var listResult = Paging.GetResultInfo(totalRecords, _pageNo, _pageSize); var paging = Paging.GetPaging(totalRecords, _pageNo, _pageSize, _pageStatus, Common.defaultNoOfPageLinkList, "$common.pagingClick", orderBy, order); var itemPerPage = Paging.getItemPerPage(totalRecords, _pageSize, orderBy, order); PageUtilities pageUtilities = new PageUtilities() { listHeader = listResult, listFooter = paging + itemPerPage, order = order, orderBy = orderBy }; diagnosisModel = new DiagnosisModels { dtodiagnosiss = dtodiagnosiss, pageUtilities = pageUtilities, }; } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } return(View(diagnosisModel)); }