Пример #1
0
        public PrivateProfileDto GetPrivateProfile(Guid userId)
        {
            var user = _session.Query <User>()
                       .Fetch(x => x.ProfileImages)
                       .Fetch(x => x.Location).Single(x => x.Id == userId);
            var profileDto =
                new PrivateProfileDto
            {
                Address      = user.Location.Address,
                City         = user.Location.City,
                Country      = user.Location.Country,
                Postcode     = user.Location.Postcode,
                Suburb       = user.Location.Suburb,
                Lat          = user.Location.Latitude,
                Long         = user.Location.Longitude,
                FirstName    = user.FirstName,
                LastName     = user.LastName,
                Description  = user.Description,
                Friendship   = user.Friendship,
                Orientation  = user.Orientation,
                Gender       = user.Gender,
                Romance      = user.Romance,
                Age          = user.Age,
                ProfileImage = user.ProfileImageUrl ?? PlaceholderImage
            };

            profileDto.ProfileImageUrls =
                user.ProfileImages.Select(i => new ImageDto
            {
                Url      = i.Url,
                FileName = i.ImageName
            }).ToList();
            return(profileDto);
        }
Пример #2
0
 public PrivateProfileDto GetPrivateProfile(Guid userId)
 {
     var user = _session.Query<User>()
                        .Fetch(x => x.ProfileImages)
                        .Fetch(x => x.Location).Single(x => x.Id == userId);
     var profileDto =
         new PrivateProfileDto
         {
             Address = user.Location.Address,
             City = user.Location.City,
             Country = user.Location.Country,
             Postcode = user.Location.Postcode,
             Suburb = user.Location.Suburb,
             Lat = user.Location.Latitude,
             Long = user.Location.Longitude,
             FirstName = user.FirstName,
             LastName = user.LastName,
             Description = user.Description,
             Friendship = user.Friendship,
             Orientation = user.Orientation,
             Gender = user.Gender,
             Romance = user.Romance,
             Age = user.Age,
             ProfileImage = user.ProfileImageUrl ?? PlaceholderImage
         };
     profileDto.ProfileImageUrls =
         user.ProfileImages.Select(i => new ImageDto
         {
             Url = i.Url,
             FileName = i.ImageName
         }).ToList();
     return profileDto;
 }