public List <ProductDto> GetItemsOfSearchValue(SearchValueDto filter) { var items = _productrepository.GetAll().Where(x => (filter.SearchValue == "" || x.ProductTitle.Contains(filter.SearchValue)) && (filter.CategoryId == 0 || x.ProductId == filter.CategoryId)).ToList(); List <ProductDto> productDtos = new List <ProductDto>(); return(productDtos); }
//api/{controller}/{action}/{id}" public IHttpActionResult GetItemsOfSearchValue(SearchValueDto filter) { filter = new SearchValueDto { SearchValue = "", CategoryId = 0, Condition = 1, FreeShipping = false, Price = 10 }; IEnumerable <ProductDto> items = _productRepository.GetItemsOfSearchValue(filter); //ProductDto item = _productRepository.GetProductById(id); // var item = items.FirstOrDefault((p) => p.id == id); _itemRepository.GetItemById(id); return(Ok(items)); }