public async Task <IActionResult> Get(int id) { DtoCar result = await _carService.GetCarId(id); if (result == null) { return(NotFound()); } return(Ok(result)); }
/// <summary> /// Get Car by Id /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <DtoCar> GetCarId(int id) { DtoCar User = await _carRepository.GetCars().AsNoTracking().Where(c => c.Id == id).ProjectTo <DtoCar>(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); return(User); }