예제 #1
0
        public void MakeProfilePhoto(long profileId, Guid photoGuid)
        {
            var profile = _profileRepository.SingleAttached(p => p.Id == profileId, p => p.Photos);

            if (profile == null)
            {
                return;
            }
            if (!profile.Photos.Any(photo => photo.Guid == photoGuid))
            {
                throw new HttpException(404, "Photo not found!");
            }
            profile.ProfilePhotoGuid = photoGuid;
            _profileRepository.FullUpdate(profile);
            _profileService.UpdateRavenProfile(profile.Id);
        }
예제 #2
0
        public virtual Profile UpdateProfile(Profile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
            if (!String.IsNullOrEmpty(profile.FriendlyName))
            {
                if (_profileRepository.CheckIfFriendlyNameExists(profile.FriendlyName, profile.Id))
                {
                    throw new KatushaFriendlyNameExistsException(profile);
                }
            }
            if (!(profile.Gender == (byte)Sex.Male || profile.Gender == (byte)Sex.Female))
            {
                throw new KatushaGenderNotExistsException(profile);
            }
            var cityName    = _resourceService.GetLookupText("City", profile.Location.CityCode.ToString(CultureInfo.InvariantCulture), profile.Location.CountryCode);
            var countryName = _resourceService.GetLookupText("Country", profile.Location.CountryCode);
            var dataProfile = _profileRepository.SingleAttached(p => p.Id == profile.Id);

            dataProfile.FriendlyName         = profile.FriendlyName;
            dataProfile.Name                 = profile.Name;
            dataProfile.Alcohol              = profile.Alcohol;
            dataProfile.BirthYear            = profile.BirthYear;
            dataProfile.BodyBuild            = profile.BodyBuild;
            dataProfile.Location.CountryCode = profile.Location.CountryCode;
            dataProfile.Location.CityCode    = profile.Location.CityCode;
            dataProfile.Location.CityName    = cityName;
            dataProfile.Location.CountryName = countryName;
            dataProfile.Description          = profile.Description;
            dataProfile.EyeColor             = profile.EyeColor;
            dataProfile.HairColor            = profile.HairColor;
            dataProfile.Height               = profile.Height;
            dataProfile.Religion             = profile.Religion;
            dataProfile.Smokes               = profile.Smokes;
            dataProfile.ProfilePhotoGuid     = profile.ProfilePhotoGuid;
            dataProfile.Gender               = profile.Gender;
            dataProfile.DickSize             = profile.DickSize;
            dataProfile.DickThickness        = profile.DickThickness;
            dataProfile.BreastSize           = profile.BreastSize;

            _profileRepository.FullUpdate(dataProfile);

            UpdateRavenProfile(dataProfile.Id);
            return(dataProfile);
        }