public async Task <IActionResult> Append([FromBody] CarModel car)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            return(new ObjectResult(await _carsData.Append(car)));
        }
예제 #2
0
        public async Task <CarModel> Append(CarModel car)
        {
            var carDataModel = _mapper.Map <CarModel, CarDataModel>(car);

            await _carToolContext.AddAsync(carDataModel);

            await _carToolContext.SaveChangesAsync();


            return(_mapper.Map <CarDataModel, CarModel>(carDataModel));
        }