/// <summary> /// Updates the profile of an <see cref="UserContract"/>. /// </summary> /// <param name="user">The <see cref="UserContract"/>.</param> public void UpdateMyProfile(UserContract user) { this.ManageException( action: () => { if (user == null) { throw new InvalidOperationException(message: "user can't be null"); } if (user.UserId <= 0) { throw new InvalidOperationException(message: "unknown user"); } if (user.UserId != this.currentUserId) { throw new InvalidOperationException(message: "not allowed to update profile"); } if (this.store.UserExist(userName: user.UserName)) { var knownUser = this.store.LoadUser(userName: user.UserName); if (knownUser.UserId != user.UserId) { throw FaultExceptionHelper.From(error: ErrorType.AlreadyConnectedUser, exception: null); } } this.store.AddOrUpdateUser(user: user.FromContract()); this.notificationManager.NotifyUserChange(userId: user.UserId); }, description: "UpdateMyProfile"); }