Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
        public async Task <IEnumerable <CarDTO> > BrowseAsync()
        {
            var cars = await _carRepository.BrowseAsync();

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

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