Пример #1
0
        public IActionResult PaginationPage_a(NewsDataPagination_a_ViewModels model, int currentPage, string sortByColumn, string sortByOrder)
        {
            int currentPage_ = currentPage == 0 ? CurrentPage : currentPage;
            NewsSearchDataResponse newsSearchDataResponse = new NewsSearchDataResponse();
            //NewsDataPaginationViewModels res = videoRepository.GetNewsList(2, NewsTypes.All, page, pagesize, sortByColumn, sortByOrder);
            NewsDataPagination_a_ViewModels res            = videoRepository.GetNewsList_a(2, NewsTypes.All, currentPage_, PAGESIZE, sortByColumn, sortByOrder);
            List <NewsSearchData>           searchDataList = new List <NewsSearchData>();

            if (res != null && res.NewsDatasList.Count > 0)
            {
                foreach (var item in res.NewsDatasList)
                {
                    NewsSearchData data = new NewsSearchData();
                    data.Description = item.description;
                    data.Name        = item.lName;
                    data.Path        = item.Path;

                    searchDataList.Add(data);
                }

                newsSearchDataResponse.news         = searchDataList;
                newsSearchDataResponse.errorMessage = "";
                newsSearchDataResponse.totalRow     = res.paging_A_Info?.totalItems ?? 0;
            }
            else
            {
                newsSearchDataResponse.errorMessage = "There was some error in the server!";
            }

            //return Json(newsSearchDataResponse);
            return(View("PaginationPage_a", res));
        }
Пример #2
0
        public JsonResult LoadPagination(int page, int rowStart, int pagesize, string sortByColumn, string sortByOrder)
        {
            NewsSearchDataResponse       newsSearchDataResponse = new NewsSearchDataResponse();
            NewsDataPaginationViewModels res            = videoRepository.GetNewsList(2, NewsTypes.All, page, pagesize, sortByColumn, sortByOrder);
            List <NewsSearchData>        searchDataList = new List <NewsSearchData>();

            if (res != null && res.NewsDatasList.Count > 0)
            {
                foreach (var item in res.NewsDatasList)
                {
                    NewsSearchData data = new NewsSearchData();
                    data.Description = item.description;
                    data.Name        = item.lName;
                    data.Path        = item.Path;

                    searchDataList.Add(data);
                }

                newsSearchDataResponse.news         = searchDataList;
                newsSearchDataResponse.errorMessage = "";
                newsSearchDataResponse.totalRow     = res.PagingInfo.TotalItems;
            }
            else
            {
                newsSearchDataResponse.errorMessage = "There was some error in the server!";
            }

            return(Json(newsSearchDataResponse));
        }