public IActionResult Update(string exampleId, Example exampleToUpdate) { if (exampleToUpdate == null) { return(BadRequest(ModelState)); } if (exampleId != exampleToUpdate.Id) { return(BadRequest(ModelState)); } if (!exampleRepository.ExampleExists(exampleId)) { return(NotFound()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!exampleRepository.Update(exampleToUpdate)) { ModelState.AddModelError("", "Update Error"); return(StatusCode(500)); } return(Ok("Update Success")); }