Пример #1
0
        public async Task <ShyneeProfileFieldsPrivacyDto> UpdateShyneeProfileFieldsPrivacyAsync(
            Guid id,
            ShyneeProfileFieldsPrivacyDto fieldsPrivacy)
        {
            var shynee = await _shyneesRepository.GetShyneeAsync(id);

            var shyneeProfileToUpdate = new ShyneeProfile(
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.Nickname,
                    shynee.Profile.Nickname.Parameter),
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.AvatarUri,
                    shynee.Profile.AvatarUri.Parameter),
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.Name,
                    shynee.Profile.Name.Parameter),
                new ShyneeProfileParameter <DateTime?>(
                    fieldsPrivacy.Dob,
                    shynee.Profile.Dob.Parameter),
                new ShyneeProfileParameter <Gender>(
                    fieldsPrivacy.Gender,
                    shynee.Profile.Gender.Parameter),
                new ShyneeProfileParameter <string[]>(
                    fieldsPrivacy.Interests,
                    shynee.Profile.Interests.Parameter),
                new ShyneeProfileParameter <string>(
                    fieldsPrivacy.PersonalInfo,
                    shynee.Profile.PersonalInfo.Parameter));

            shynee.UpdateProfile(shyneeProfileToUpdate);
            await _shyneesRepository.UpdateShyneeAsync(shynee);

            return(fieldsPrivacy);
        }
        public ShyneeProfileFieldsPrivacyDto GenerateProfileFieldsBoolValues()
        {
            var shyneeProfileFieldsPrivacy = new ShyneeProfileFieldsPrivacyDto(
                Nickname.Status == ShyneeProfileParameterStatus.Visible ?
                true : false,
                AvatarUri.Status == ShyneeProfileParameterStatus.Visible ?
                true : false,
                Name.Status == ShyneeProfileParameterStatus.Visible ?
                true : false,
                Dob.Status == ShyneeProfileParameterStatus.Visible ?
                true : false,
                Gender.Status == ShyneeProfileParameterStatus.Visible ?
                true : false,
                Interests.Status == ShyneeProfileParameterStatus.Visible ?
                true : false,
                PersonalInfo.Status == ShyneeProfileParameterStatus.Visible ?
                true : false);

            return(shyneeProfileFieldsPrivacy);
        }