public bool Put(int id, [FromBody] User user) { User userToUpdate = userRepo.Get(x => x.Id == user.Id).FirstOrDefault(); if (userToUpdate != null) { userToUpdate.FirstName = user.FirstName; userToUpdate.LastName = user.LastName; userRepo.Update(userToUpdate); return(true); } else { return(false); } }
public bool Put(int id, [FromBody] Post post) { Post postToUpdate = postRepo.Get(x => x.Id == post.Id).FirstOrDefault(); if (postToUpdate != null) { postToUpdate.Title = post.Title; postToUpdate.Description = post.Description; postRepo.Update(postToUpdate); return(true); } else { return(false); } }