示例#1
0
        public List <PlaylistItemEntity> AddItems(string playlistId, IEnumerable <VideoId> items)
        {
            var entities = items.Where(itemId => !_itemsDbService.Exists(x => x.PlaylistId == playlistId && x.ContentId == itemId)).Select(item => new PlaylistItemEntity()
            {
                PlaylistId = playlistId,
                ContentId  = item,
            }).ToList();

            _itemsDbService.UpdateItem(entities);
            return(entities);
        }
示例#2
0
        public void AddItem(string playlistId, string contentId)
        {
            if (_itemsDbService.Exists(x => x.PlaylistId == playlistId && x.ContentId == contentId))
            {
                return;
            }

            _itemsDbService.UpdateItem(new PlaylistItemEntity()
            {
                PlaylistId = playlistId,
                ContentId  = contentId,
            });
        }