public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId)
        {
            ShareCode    shareCode    = ShareCodeManager.GetShareCode(entityType, entityId);
            ShareCodeDto shareCodeDto = ShareCodeDto.Create(shareCode);

            return(new JsonServiceStackResult(shareCodeDto));
        }
Example #2
0
        public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId)
        {
            ShareCode    shareCode    = ShareCodeManager.GetShareCode(entityType, entityId);
            ShareCodeDto shareCodeDto = ShareCodeDto.Create(shareCode);

            return(new JsonDataContractActionResult(shareCodeDto));
        }
Example #3
0
        public static ShareCode Create(ShareCodeDto shareCodeDto)
        {
            ShareCode shareCode = new ShareCode
            {
                EntityId               = shareCodeDto.EntityId,
                EntityType             = shareCodeDto.EntityType,
                Id                     = shareCodeDto.Id,
                ShortId                = shareCodeDto.ShortId,
                UrlFriendlyEntityTitle = shareCodeDto.UrlFriendlyEntityTitle
            };

            return(shareCode);
        }
Example #4
0
        public ShareCodeDto GetShareCodeByShortIdAndEntityTitle(string shortId, string entityTitle)
        {
            ShareCodeDto shareCodeDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                ShareCode shareCode = ShareCodeManager.GetByShortIdAndEntityTitle(shortId, entityTitle);
                shareCodeDto = ShareCodeDto.Create(shareCode);

                transaction.Commit();
            }

            return(shareCodeDto);
        }
        public ShareCodeDto GetShareCode(Guid playlistId)
        {
            ShareCodeDto shareCodeDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                Playlist  playlist  = PlaylistManager.CopyAndSave(playlistId);
                ShareCode shareCode = ShareCodeManager.GetShareCode(playlist);
                shareCodeDto = ShareCodeDto.Create(shareCode);

                transaction.Commit();
            }

            return(shareCodeDto);
        }
Example #6
0
        public ShareCodeDto GetShareCode(Guid playlistId)
        {
            ShareCodeDto shareCodeDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                //  Copy the playlist here to serve a static copy instead of whatever the state is when share code is accessed.
                Playlist  playlist  = PlaylistManager.CopyAndSave(playlistId);
                ShareCode shareCode = ShareCodeManager.GetShareCode(playlist);
                shareCodeDto = ShareCodeDto.Create(shareCode);

                transaction.Commit();
            }

            return(shareCodeDto);
        }
Example #7
0
        public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId)
        {
            if (entityType != ShareableEntityType.Playlist)
            {
                throw new NotSupportedException("Only Playlist entityType can be shared currently.");
            }

            ShareCodeDto shareCodeDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                Playlist  playlist  = PlaylistManager.CopyAndSave(entityId);
                ShareCode shareCode = ShareCodeManager.GetShareCode(playlist);
                shareCodeDto = ShareCodeDto.Create(shareCode);

                transaction.Commit();
            }

            return(Json(shareCodeDto));
        }
Example #8
0
        public static ShareCode Create(ShareCodeDto shareCodeDto)
        {
            ShareCode shareCode = Mapper.Map <ShareCodeDto, ShareCode>(shareCodeDto);

            return(shareCode);
        }