Putting it all together (inserting a car)
Let’s put this together using controller, service, and repository to insert a car with Dapper and AutoMapper:
//Controller [HttpPost] public async Task<ActionResult<Car>> Insert([FromBody] CarDto carAsDto) { try { if (carAsDto == null) { return BadRequest("No car was provided"); } var carToInsert = _mapper.Map<Car>(carAsDto); var insertedCar = await _carService.Insert(carToInsert); var insertedCarDto = _mapper.Map<CarDto>(insertedCar)...