public async Task <IEnumerable <RentalPropertyIndex> > MatchRentalPropertyByFirm(int firmId, UserQuery query) { var propertyList = await _manager.GetActiveRentalPropertyByProvider(firmId); var result = _match.MatchRentalProperty(query, propertyList); string stringQuery = $"Number of occupants: {query.NumberofAdult + query.NumberofChildren}. max price: {query.maxPrice}, min price: {query.minPrice}"; string location = $"{query.City}, {query.State}"; _manager.AddSearchQueryToLog(stringQuery, location, firmId, PropertyType.Rental, result.Count, 0); return(result.OrderByDescending(m => m.Rank)); }
public async Task <IActionResult> MatchLandPropertyByFirm(int firmId, LandPropertyQuery query) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var propertyList = await _manager.GetAllActiveLandPropertiesByFirm(firmId); var result = _match.MatchOnLandProperty(query, propertyList); string stringQuery = $"Land Area: {query.area}. max price: {query.maxPrice}, min price: {query.minPrice}"; string location = $"{query.City}, {query.State}"; _manager.AddSearchQueryToLog(stringQuery, location, firmId, PropertyType.LandProperty, result.Count, 0); return(Ok(result.OrderByDescending(m => m.Rank))); }