public async Task <ActionResult <Ninja> > UpdateNinja(long id, Ninja ninja) { try { if (id != ninja.Id) { return(BadRequest("Chase ID mismatch")); } var ninjaToUpdate = await ninjaRepository.GetNinja(id); if (ninjaToUpdate == null) { return(NotFound($"Chase with id {id} not found")); } return(await ninjaRepository.UpdateNinja(ninja)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error updating data")); } }