Exemplo n.º 1
0
        public static async Task <bool> DeleteTrackFollow(string userId, string trackId, bool ownerOverride = false)
        {
            try
            {
                TrackAuth track = await TrackRepository.GetTrack(trackId);

                if (track.PartitionKey == userId && ownerOverride == false)
                {
                    return(false);
                }

                UserFollowTableEntity userFollow = await TableStorageRepository.GetUserFollow(userId, trackId);

                TrackFollowTableEntity trackFollow = await TableStorageRepository.GetTrackFollow(trackId, userId);

                if (userFollow != null)
                {
                    await TableStorageRepository.DeleteUserFollow(userFollow);
                }

                if (trackFollow != null)
                {
                    await TableStorageRepository.DeleteTrackFollow(trackFollow);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        private static async void InsertOrReplaceUserFollow(string userId, string trackId)
        {
            TrackAuth track = await TrackRepository.GetTrack(trackId);

            TableStorageRepository.InsertOrReplaceUserFollow(new UserFollowTableEntity(userId, trackId)
            {
                description = track.description,
                has_image   = track.has_image,
                is_private  = track.is_private,
                name        = track.name
            });
        }