Exemple #1
0
        public IActionResult Post([FromBody] MotorBike value)
        {
            if (string.IsNullOrWhiteSpace(value.Name))
            {
                return(BadRequest("Name cannot be empty"));
            }

            value.Id = _bikes.Max(p => p.Id) + 1;
            _bikes.Add(value);
            return(Created($"/api/MotorBikeApi/{value.Id}", value));
        }