Example #1
0
        void SqlFriendRequestsTableDependencyChanged(object sender, RecordChangedEventArgs <FriendRequest> e)
        {
            if (e.ChangeType == ChangeType.Insert)
            {
                var          userProfileActor  = _userProfileService.GetUserProfile(e.Entity.InitiatorUserProfileId);
                var          friendRequest     = _friendRequestService.GetFriendRequest(e.Entity.Id);
                var          userProfileTarget = _userProfileService.GetUserProfile(friendRequest.TargetUserProfileId);
                Notification notification      = null;

                notification = _notificationService.AddFriendRequestNotification(userProfileTarget.Id, userProfileActor.Name + " wants to be friends.",
                                                                                 "", userProfileActor.Name + " wants to be friends.", "/friend-requests/" + friendRequest.Id, e.Entity.Id.ToString());

                if (notification != null)
                {
                    LikeWatcherHub.PushNotification(notification, userProfileTarget.Id);
                }
            }
        }