public IHttpActionResult FindSpecificationType(int specificationTypeId) { return(Ok( _specificationTypeMapper.ToDto( _specificationTypeService.FindSpecificationType(specificationTypeId) ) )); }
public IHttpActionResult FilterCarOnSpecification(FilterBasedOnSpecification filterBasedOnSpecification) { if (filterBasedOnSpecification.SpecificationType.Equals("Bouwjaar")) { return(BadRequest("please use filter/car/bouwjaar when wanting to filter on 'Bouwjaar'")); } // throws exception if not found _specificationTypeService.FindSpecificationType(filterBasedOnSpecification.SpecificationType); List <Product> filterCarsOnSpecification = _carService.FilterCarsOnSpecification( filterBasedOnSpecification.SpecificationType, filterBasedOnSpecification.Value); List <CarResponseDto> responseDtos = new List <CarResponseDto>(); foreach (Product product in filterCarsOnSpecification) { responseDtos.Add(_carsMapper.ToDto(product)); } return(Ok(responseDtos)); }