public void Can_Get_Filtered_Paging_List() { var request = new LpcReportRequest { PageSize = 20, Page = 1, Borough = "Manhattan", }; var results = _lpcReportService.GetLPCReports(request).Results; Assert.Equal(request.PageSize, results.Count); }
public IActionResult Get([FromQuery] LPCReportRequestModel query, int limit, int page) { var request = new LpcReportRequest { PageSize = limit, Page = page, SortColumn = !string.IsNullOrEmpty(query.Sort) ? query.Sort : "LPNumber", SortOrder = !string.IsNullOrEmpty(query.Order) ? query.Order : "asc", ParentStyleList = !string.IsNullOrEmpty(query.ParentStyles) ? query.ParentStyles.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList() : null, Neighborhood = !string.IsNullOrWhiteSpace(query.Neighborhood) ? query.Neighborhood.Trim() : null, Borough = !string.IsNullOrWhiteSpace(query.Borough) ? query.Borough.Trim() : null, ObjectType = !string.IsNullOrWhiteSpace(query.ObjectType) ? query.ObjectType.Trim() : null, }; var records = _lpcReportService.GetLPCReports(request); var totalRecords = records.Total; HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "X-InlineCount"); HttpContext.Response.Headers.Add("X-InlineCount", totalRecords.ToString()); return(Ok(records.Results)); }