public IActionResult GetById(int id) { var User = UserContract.Find(id); if (User == null) { return(new ObjectResult(new User())); } return(Ok(User)); }
public IActionResult Delete(int id) { //UserRepository.Remove(id); var User = UserContract.Find(id); if (User == null) { return(NotFound("User record couldn't be found.")); } UserContract.Remove(id); return(NoContent()); }
public IActionResult Update(int id, [FromBody] User value) { if (value is null) { return(BadRequest("value is null.")); } var User = UserContract.Find(id); if (User == null) { return(NotFound("User record couldn't be found.")); } if (!ModelState.IsValid) { return(BadRequest()); } UserContract.Update(value); return(new NoContentResult()); }