public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId) { ShareCode shareCode = ShareCodeManager.GetShareCode(entityType, entityId); ShareCodeDto shareCodeDto = ShareCodeDto.Create(shareCode); return new JsonServiceStackResult(shareCodeDto); }
public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId) { ShareCode shareCode = ShareCodeManager.GetShareCode(entityType, entityId); ShareCodeDto shareCodeDto = ShareCodeDto.Create(shareCode); return(new JsonServiceStackResult(shareCodeDto)); }
public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId) { ShareCode shareCode = ShareCodeManager.GetShareCode(entityType, entityId); ShareCodeDto shareCodeDto = ShareCodeDto.Create(shareCode); return(new JsonDataContractActionResult(shareCodeDto)); }
public JsonResult GetShareCode(ShareableEntityType entityType, Guid entityId) { ShareCode shareCode = ShareCodeManager.GetShareCode(entityType, entityId); ShareCodeDto shareCodeDto = ShareCodeDto.Create(shareCode); return new JsonDataContractActionResult(shareCodeDto); }
public ShareCode GetShareCode(ShareableEntityType entityType, Guid entityId) { // TODO: Support sharing other entities. if (entityType != ShareableEntityType.Playlist) throw new NotSupportedException("Only Playlist entityType can be shared currently."); ShareCode shareCode; try { Playlist playlistToCopy = PlaylistDao.Get(entityId); if (playlistToCopy == null) { string errorMessage = string.Format("No playlist found with id: {0}", entityId); throw new ApplicationException(errorMessage); } var shareablePlaylistCopy = new Playlist(playlistToCopy); PlaylistManager.Save(shareablePlaylistCopy); shareCode = new ShareCode(shareablePlaylistCopy); Save(shareCode); } catch (Exception exception) { Logger.Error(exception); throw; } return shareCode; }
public ShareCode GetShareCode(ShareableEntityType entityType, Guid entityId) { // TODO: Support sharing other entities. if (entityType != ShareableEntityType.Playlist) { throw new NotSupportedException("Only Playlist entityType can be shared currently."); } ShareCode shareCode; try { Playlist playlistToCopy = PlaylistDao.Get(entityId); if (playlistToCopy == null) { string errorMessage = string.Format("No playlist found with id: {0}", entityId); throw new ApplicationException(errorMessage); } var shareablePlaylistCopy = new Playlist(playlistToCopy); PlaylistManager.Save(shareablePlaylistCopy); shareCode = new ShareCode(shareablePlaylistCopy); Save(shareCode); } catch (Exception exception) { Logger.Error(exception); throw; } return(shareCode); }
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); }
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)); }