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() }); }
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() }); }
public static UserInfoDTO ToUserInfoDTO(this Domain.User user) { return(new UserInfoDTO(userId: user.Id, userName: user.Name)); }
public static UserInfo ToUserInfo(this Domain.User user) { return(new UserInfo(user.Id, user.Name)); }