public ActionResult Index(MeteringPointSearchRequest request)
        {
            var result = _meteringCodeService.GetMeteringPointsByCustomerId(request);
            MeteringPointViewModel viewModel = new MeteringPointViewModel();

            viewModel.data            = result.MeteringPoints;
            viewModel.recordsFiltered = result.TotalCount;
            viewModel.recordsTotal    = result.TotalCount;
            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }
        public MeteringPointResponse GetMeteringPointsByCustomerId(MeteringPointSearchRequest searchRequest)
        {
            int  fromRow         = (searchRequest.PageNo - 1) * searchRequest.PageSize;
            bool searchSpecified = !string.IsNullOrEmpty(searchRequest.Param);
            int  toRow           = searchRequest.PageSize;

            Func <MeteringPoint, bool> expression =
                s => (!searchSpecified && s.CrmAccountId == searchRequest.CustomerId || (s.CrmAccountId == searchRequest.CustomerId && s.Kurzbezeichnung.IndexOf(searchRequest.Param, StringComparison.OrdinalIgnoreCase) >= 0));

            IEnumerable <MeteringPoint> oList =
                searchRequest.IsAsc ?
                meteringPoints.Where(expression).OrderBy(userActivityClause[searchRequest.OrderBy]).Skip(fromRow).Take(toRow).ToList() :
                meteringPoints.Where(expression).OrderByDescending(userActivityClause[searchRequest.OrderBy]).Skip(fromRow).Take(toRow).ToList();

            return(new MeteringPointResponse {
                MeteringPoints = oList, TotalCount = meteringPoints.Where(expression).ToList().Count
            });
        }