public User Convert(SCUser user) { if (user == null) { return null; } return new User { Id = user.Id, Permalink = user.Permalink, UserName = user.UserName, Uri = user.Uri, PermalinkUrl = user.PermalinkUrl, AvatarUrl = user.Avatar == null ? null : user.Avatar.Url(), Country = user.Country, FullName = user.FullName, City = user.City, Description = user.Description, Discogs = user.Discogs, Myspace = user.Myspace, Website = user.WebsiteUrl, WebsiteTitle = user.WebsiteTitle, IsOnline = user.IsOnline, TrackCount = user.TrackCount, EmailConfirmed = user.EmailConfirmed, FavoriteCount = user.FavoriteCount, FollowerCount = user.FollowerCount, FollowingCount = user.FollowingCount, Plan = user.Plan, PlaylistCount = user.PlaylistCount, PrivatePlaylistCount = user.PrivatePlaylistCount, PrivateTrackCount = user.PrivateTrackCount }; }
public SCUser UpdateUser(SCUser user) { if (!string.IsNullOrEmpty(userId) && user.Id != userId) { throw new SoundCloudApiException(string.Format("Context set for userId = {0}. Create new context for update another user.", userId)); } var currentUser = GetInternalUser(); var diff = currentUser.GetDiff(userConverter.Convert(user)); var parameters = diff.ToDictionary(x => string.Format("user[{0}]", x.Key), x => x.Value); var updatedUser = soundCloudRawClient.Request<User>(prefix, string.Empty, HttpMethod.Put, parameters); return userConverter.Convert(updatedUser); }