public IActionResult PostPlayer([FromBody] Player player) { if (player == null) { return(BadRequest(ModelState)); } if (_playerRepo.Exists(player)) { ModelState.AddModelError("", $"Player with nbaId {player.NbaId} already exists"); return(StatusCode(422, ModelState)); } else { _playerRepo.PostPlayer(player); } return(Ok(player)); }