public PagedResultModel <LandmarkModel> GetLandmarks(LandmarkRequest request)
        {
            var predicate = PredicateBuilder.True <Landmark>();

            if (!string.IsNullOrEmpty(request.LpcNumber))
            {
                predicate = predicate.And(x => x.LP_NUMBER == request.LpcNumber);
            }

            var sortModel = new SortModel
            {
                SortColumn = !string.IsNullOrEmpty(request.SortColumn) ? request.SortColumn : null,
                SortOrder  = !string.IsNullOrEmpty(request.SortOrder) ? request.SortOrder : null
            };

            var sortingList = new List <SortModel>();

            sortingList.Add(sortModel);

            int totalCount = _landmarkRepository.FindBy(predicate).Count();

            var results = _landmarkRepository
                          .GetPage(predicate, request.PageSize * (request.Page - 1), request.PageSize, sortingList);

            var modelData = Mapper.Map <IEnumerable <Landmark>, IEnumerable <LandmarkModel> >(results).ToList();

            return(new PagedResultModel <LandmarkModel>
            {
                Total = totalCount,
                Page = request.Page,
                Limit = request.PageSize,
                Results = modelData,
            });
        }
        public void Can_Get_Filtered_Paging_List()
        {
            var predicate = PredicateBuilder.True <Landmark>();
            var request   = new LandmarkRequest()
            {
                PageSize = 20,
                Page     = 1,
            };

            var sortModel = new SortModel
            {
                SortColumn = !string.IsNullOrEmpty(request.SortColumn) ? request.SortColumn : null,
                SortOrder  = !string.IsNullOrEmpty(request.SortOrder) ? request.SortOrder : null,
            };

            var sortingList = new List <SortModel>();

            sortingList.Add(sortModel);

            var results = _landmarkRepository
                          .GetPage(predicate, request.PageSize * (request.Page - 1), request.PageSize, sortingList);

            Assert.NotNull(results);
        }