public IHttpActionResult Search(string view, string quickSearch, int?minPrice, int?maxPrice, int?minYear, int?maxYear) { //check model state befor try _listingManager = ListingManagerFactory.Create(); try { var parameters = new ListingSearchParameters() { View = view, QuickSearch = quickSearch, MinPrice = minPrice, MaxPrice = maxPrice, MinYear = minYear, MaxYear = maxYear }; var result = _listingManager.Search(parameters); return(Ok(result.Payload)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }