Exemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] Unit unit)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestResult());
            }

            var id = await _db.AddUnitAsync(unit);

            return(CreatedAtAction(nameof(Get), new { unitId = id }, unit));
        }