public void DeleteUserFromPost(User user) { var isInAlready = UsersInvolved.SingleOrDefault(x => x.Id == user.Id); if (isInAlready == null) { throw new Exception($"User {user.Name} is not involved"); } _usersIvolved.Remove(user); UpdatedAt = DateTime.UtcNow; }
public void AddUserToPost(User user) { var isInAlready = UsersInvolved.SingleOrDefault(x => x.Id == user.Id); if (isInAlready != null) { throw new Exception($"User {user.Name} is already involved"); } _usersIvolved.Add(user); UpdatedAt = DateTime.UtcNow; }