Пример #1
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()
     });
 }
Пример #2
0
 public static UserEntity ToEntity(this Domain.User user)
 {
     return(new UserEntity()
     {
         Id = user.Id,
         Name = user.Name,
         Weight = user.Weight,
         Gender = user.Gender,
         ProfileImageUrl = user.ProfileImageUrl,
         PushInfo = user.PushInfo,
         Friends = user.Friends?.ToList(),
         CurrentVenue = user.CurrentVenue != null ? new VenueEntity()
         {
             Id = user.CurrentVenue.Id,
             Location = user.CurrentVenue.Location,
             Name = user.CurrentVenue.Name,
             Distance = user.CurrentVenue.Distance
         } : null,
         Language = user.Language,
         LastOnline = user.LastOnline,
         PendingFriendRequests = user.PendingFriendRequests?.ToList(),
         Invitations = user.Invitations?.ToList()
     });
 }
Пример #3
0
 public static UserInfoDTO ToUserInfoDTO(this Domain.User user)
 {
     return(new UserInfoDTO(userId: user.Id, userName: user.Name));
 }
Пример #4
0
 public static UserInfo ToUserInfo(this Domain.User user)
 {
     return(new UserInfo(user.Id, user.Name));
 }