Example #1
0
        public async Task GetCarModelsTest()
        {
            var cars = CarDataSeeder.GetEntities().ToArray();
            await _carRepository.AddAsync(cars[0]);

            await _carRepository.AddAsync(cars[1]);

            Assert.Equal(2, (await _carModelService.GetCarModelsAsync()).Count());
        }
        public async Task <ActionResult <Page <CarModelDTO> > > GetCarModelsAsync(
            int pageNumber     = Page.FIRST,
            int pageSize       = Page.DEFAULT_SIZE,
            string orderBy     = null,
            string name        = null,
            int?manufacturerId = null
            )
        {
            try
            {
                var res = await carModelService.GetCarModelsAsync(
                    pageNumber,
                    pageSize,
                    orderBy,
                    name,
                    manufacturerId);

                return(Ok(res));
            }
            catch
            {
                return(StatusCode(500, "Internal server error"));
            }
        }