Beispiel #1
0
        public async Task <CommonResponse> UpdateProfilePrivacy(string QueryUserID, UserProfilePrivacy updatedPrivacy)
        {
            var oldPrivacy = GetProfilePrivacy(QueryUserID);

            if (oldPrivacy != null)
            {
                var merged = TypeMerger.MergeProperties(oldPrivacy, updatedPrivacy, "Userid");
                if (await _users.UpdateProfilePrivacy(merged))
                {
                    return new CommonResponse {
                               StatusCode = 0
                    }
                }
                ;
            }

            return(new CommonResponse {
                StatusCode = -1
            });
        }
Beispiel #2
0
        public CommonResponse GetProfile(string QueryUserID, string ClaimsUserID)
        {
            var user = _users.GetProfile(QueryUserID);

            if (user == null)
            {
                return new CommonResponse {
                           StatusCode = -1
                }
            }
            ;
            else
            {
                var applied = ApplyPrivacyToUserProfile(user, _users.GetProfilePrivacy(user.Userid), QueryUserID == ClaimsUserID);

                return(TypeMerger.MergeProperties(new GetprofileResponse {
                    StatusCode = 0
                }, applied));
            }
        }
Beispiel #3
0
        public async Task <CommonResponse> ModifyProfile(string UserID, UserProfile NewProfile)
        {
            var user = _users.GetProfile(UserID);

            if (user != null)
            {
                var merged = TypeMerger.MergeProperties(user, NewProfile, "Userid");
                if (await _users.UpdateUserProfile(merged))
                {
                    return new CommonResponse {
                               StatusCode = 0
                    }
                }
                ;
                return(new CommonResponse {
                    StatusCode = -3
                });
            }
            return(new CommonResponse {
                StatusCode = -2
            });
        }
Beispiel #4
0
 public PlaylistMusic ToPlaylistMusic()
 {
     return(TypeMerger.MergeProperties(new PlaylistMusic(), this) as PlaylistMusic);
 }
Beispiel #5
0
 public SystemMusicLibrary ToMusicLibrary()
 {
     return(TypeMerger.MergeProperties(new SystemMusicLibrary(), this) as SystemMusicLibrary);
 }