コード例 #1
0
        public async Task <IActionResult> Post([FromBody] Vehicle vehicle)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var success = await _vehiclesService.AddAsync(vehicle);

            if (!success)
            {
                return(BadRequest());
            }

            return(Ok(vehicle));
        }