예제 #1
0
		public async Task<XCollection<Bookmark>>  RemoveBookmarks( XCollection<Bookmark> bookmarks, CancellationToken cancellationToken )
		{
			if( bookmarks != null && bookmarks.Count > 0 )
			{
				string id = bookmarks[0].ArtId;

				XCollection<Bookmark> existbookmarks = await GetBookmarksByDocumentId( id, cancellationToken ) ?? (await GetLocalBookmarksByDocumentId(id, cancellationToken ) ?? new XCollection<Bookmark>());

				if( existbookmarks.Count > 0 )
				{
					for( int i = existbookmarks.Count - 1; i >= 0; i-- )
					{
						if( bookmarks.Any( x => x.Id == existbookmarks[i].Id ) )
						{
							existbookmarks.RemoveAt( i );
						}
					}
				}

				BookmarksResponse request = new BookmarksResponse();
				request.Bookmarks = existbookmarks;

				await SaveBookmarks( id, request, cancellationToken );

			    return request.Bookmarks;
			}
		    return null;
		}