示例#1
0
        public async Task <IActionResult> GetCars(CarQueryResource carQueryResource)
        {
            var carQuery    = _mapper.Map <CarQueryResource, CarQuery>(carQueryResource);
            var queryResult = await _CarRepository.GetAll(carQuery, loadExternal : true);

            return(Ok(_mapper.Map <QueryResult <Car>, QueryResultResource <CarResource> >(queryResult)));
        }
示例#2
0
        public async Task <QueryResultResource <CarResource> > GetCars(CarQueryResource FilterResource)
        {
            // map to filter domain object
            var filter      = mapper.Map <CarQueryResource, CarQuery>(FilterResource);
            var queryResult = await repository.GetCars(filter);

            // Map QueryResult to QueryResultResource
            return(mapper.Map <QueryResult <Car>, QueryResultResource <CarResource> >(queryResult));
        }