public async Task <IActionResult> Put(int unitId, [FromBody] Unit unit) { if (!ModelState.IsValid) { return(new BadRequestResult()); } if (!await _db.IsExistingUnitAsync(unitId)) { return(new NotFoundResult()); } await _db.UpdateUnitAsync(unit); return(new NoContentResult()); }