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); }
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, }); }