public async Task <IActionResult> PostAsync([FromBody] Car car) { try { return(Ok(await _repo.AddAsync(car))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <CarViewModel> CreateCarAsync(Car car) { var createdCar = await _carsRepository.AddAsync(car); return(CarModelFactory.CreateCarViewModel(createdCar)); }