示例#1
0
        public static async Task <IQueryable <Car> > BrowseOrFailAsync(this ICarRepository repository, DateTime?productionDate = null)
        {
            var cars = await repository.BrowseAsync(productionDate);

            if (cars == null)
            {
                throw new NullResponseException($"There isn't any car with production date: {productionDate}");
            }

            return(await Task.FromResult(cars));
        }
示例#2
0
        public static async Task <IQueryable <Car> > BrowseOrFailAsync(this ICarRepository repository, string brand = null)
        {
            var cars = await repository.BrowseAsync(brand);

            if (cars == null)
            {
                throw new NullResponseException($"There isn't any car with brand: {brand}");
            }

            return(await Task.FromResult(cars));
        }
示例#3
0
        public static async Task <IQueryable <Car> > BrowseOrFailAsync(this ICarRepository repository, int?horsepower = null)
        {
            var cars = await repository.BrowseAsync(horsepower);

            if (cars == null)
            {
                throw new NullResponseException($"There isn't any car with horsepower: {horsepower}");
            }

            return(await Task.FromResult(cars));
        }
示例#4
0
        public async Task <IEnumerable <CarDTO> > BrowseAsync()
        {
            var cars = await _carRepository.BrowseAsync();

            return(_mapper.Map <IEnumerable <CarDTO> >(cars));
        }
示例#5
0
        public async Task <IEnumerable <CarDto> > BrowseAsync(string mark = null)
        {
            var cars = await _carRepository.BrowseAsync(mark);

            return(_mapper.Map <IEnumerable <CarDto> >(cars));
        }