Пример #1
0
        public async Task <IActionResult> GetAsync([FromRoute] int id)
        {
            var car = await _repositoryManager.CarRepository.GetAsync(id);

            if (car == null)
            {
                return(NotFound());
            }

            return(Ok(CarMapper.CompleteMap(car)));
        }
Пример #2
0
        public async Task <IActionResult> GetAssignedCarAsync()
        {
            var userId = HttpContext.User.GetUserId();

            var car = await _repositoryManager.CarRepository.GetAssignedCarAsync(userId.Value);

            if (car == null)
            {
                return(NotFound());
            }

            return(Ok(CarMapper.CompleteMap(car)));
        }
Пример #3
0
        public async Task <IActionResult> GetAsync()
        {
            var cars = await _repositoryManager.CarRepository.GetAsync();

            return(Ok(cars.Select(c => CarMapper.CompleteMap(c))));
        }