public List <string> GetLandmarkStreets(string lpcNumber) { var predicate = PredicateBuilder.True <Landmark>(); predicate = predicate.And(x => x.LP_NUMBER == lpcNumber); var results = _landmarktRepository.FindBy(predicate).Select(x => x.PLUTO_ADDR).ToList() .Select(x => new { x = !string.IsNullOrWhiteSpace(x) && x.Any(char.IsDigit) ? Regex.Replace(x, @"^[\d-]*\s*", "", RegexOptions.Multiline) //Regex.Replace(x, @"[\d-]", string.Empty).Trim() : x, }).Distinct().ToList(); var list = new List <string>(); foreach (var i in results) { list.Add(i.x); } var sortedList = list.OrderBy(x => x).ToList(); return(sortedList); }
public List <string> GetLandmarkStreets(string lpcNumber) { Guard.ThrowIfNullOrWhitespace(lpcNumber, "LPC Number"); var predicate = PredicateBuilder.True <Landmark>(); predicate = predicate.And(x => x.LP_NUMBER == lpcNumber); var results = _landmarkRepository.FindBy(predicate).Select(x => x.PLUTO_ADDR) .Select(x => new { x = !string.IsNullOrWhiteSpace(x) && x.Any(char.IsDigit) ? Regex.Replace(x, @"^[\d-]*\s*", "", RegexOptions.Multiline) : x, }).Distinct().ToList(); var list = new List <string>(); foreach (var i in results) { list.Add(i.x); } return(list.OrderBy(x => x).ToList()); }
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 = _landmarktRepository.FindBy(predicate).Count(); var results = _landmarktRepository .GetPage(predicate, request.PageSize * (request.Page - 1), request.PageSize, sortingList); var modelData = Mapper.Map <IEnumerable <Landmark>, IEnumerable <LandmarkModel> >(results).ToList(); var pagedResult = new PagedResultModel <LandmarkModel> { Total = totalCount, Page = request.Page, Limit = request.PageSize, Results = modelData, }; return(pagedResult); }