public void AcceptFriend(string friendId) { this.Init(); var friend = this._chatRepository.GetUserByUserId(ConnectedUsers, friendId); // store message to database IFriendRepository friendRepository = new FriendRepository(this._dbContext); friendRepository.AcceptFriend(friendId, this._curUserChat.UserId); // friend online if (friend != null) { Clients.Client(friend.ConnectionId).notifyAcceptedFriend(this._curUserChat.UserId, this._curUserChat.Displayname, this._curUserChat.Avatar); } }