public Task <YoutubeResult> GetResult(YoutubeResultType type, string contentId)
 {
     return(_context
            .YoutubeResultSet
            .Find(MakeKeyFilters(type, contentId))
            .FirstOrDefaultAsync());
 }
        public Task <bool> Delete(YoutubeResultType type, string contentId)
        {
            var item = GetResult(type, contentId);

            _dbCollectionMock.Remove(item.Result);
            return(Task.FromResult(true));
        }
        private FilterDefinition <YoutubeResult> MakeKeyFilters(YoutubeResultType type, string contentId)
        {
            var filter1 = Builders <YoutubeResult> .Filter.Eq(m => m.Type, type);

            var filter2 = Builders <YoutubeResult> .Filter.Eq(m => m.ContentId, contentId);

            return(filter1 & filter2);
        }
        public async Task <bool> Delete(YoutubeResultType type, string contentId)
        {
            var deleteResult = await _context
                               .YoutubeResultSet
                               .DeleteOneAsync(MakeKeyFilters(type, contentId));

            return(deleteResult.IsAcknowledged &&
                   deleteResult.DeletedCount > 0);
        }
        public Task <YoutubeResult> GetResult(YoutubeResultType type, string contentId)
        {
            var item = _dbCollectionMock.FirstOrDefault(x => x.Type == type && x.ContentId == contentId);

            return(Task.FromResult(item));
        }