Exemplo n.º 1
0
        private async Task SendActivityUpdateAsync(User currentUser, Activity activity, UserStatistics userStats)
        {
            var friendsAndMeUserIds = currentUser.GetVisibleFriendUserIds(true);

            var activityStats = new ActivityStatsDTO(activity.ToDto(), userStats?.ToDto());

            // send Realtime-Notification via SignalR
            await this.notificationService.SendSignalRMessageAsync(
                friendsAndMeUserIds,
                Constants.SignalR.NotificationHubName,
                Constants.SignalR.ActivityReceivedMethodName,
                activityStats);
        }
Exemplo n.º 2
0
 public static UserDTO ToDto(this Domain.User entity, UserStatistics stats = null)
 {
     return(new UserDTO()
     {
         Id = entity.Id,
         Name = entity.Name,
         PushInfo = entity.PushInfo,
         ProfileImageUrl = entity.ProfileImageUrl,
         Gender = entity.Gender,
         Language = entity.Language,
         LastOnline = entity.LastOnline,
         Weight = entity.Weight,
         CurrentVenue = entity.CurrentVenue?.ToDto(),
         Friends = entity.Friends?.Select(f => f.ToDto()).ToList(),
         CurrentStats = stats?.ToDto(),
         IncomingFriendRequests = entity.PendingFriendRequests?.Where(p => p.Direction == FriendRequestDirection.Incoming).Select(p => p.ToDto()).ToList(),
         OutgoingFriendRequests = entity.PendingFriendRequests?.Where(p => p.Direction == FriendRequestDirection.Outgoing).Select(p => p.ToDto()).ToList()
     });
 }