Ejemplo n.º 1
0
        private async Task InsertOrUpdateResult(YoutubeResult item)
        {
            var itemdb = await _repository.GetResult(item.Type, item.ContentId);

            if (itemdb == null)
            {
                await _repository.Create(item);
            }
        }
        public async Task <bool> Update(YoutubeResult item)
        {
            var found = await GetResult(item.Type, item.ContentId);

            found.Title       = item.Title;
            found.Description = item.Description;
            found.ImageUri    = item.ImageUri;

            return(true);
        }
        public async Task <bool> Update(YoutubeResult game)
        {
            var updateResult =
                await _context
                .YoutubeResultSet
                .ReplaceOneAsync(
                    filter : g => g.Id == game.Id,
                    replacement : game);

            return(updateResult.IsAcknowledged &&
                   updateResult.ModifiedCount > 0);
        }
        public async Task <YoutubeResult> Create(YoutubeResult item)
        {
            await _context.YoutubeResultSet.InsertOneAsync(item);

            return(item);
        }
 public Task <YoutubeResult> Create(YoutubeResult item)
 {
     _dbCollectionMock.Add(item);
     item.Id = new MongoDB.Bson.ObjectId(DateTime.Now, 1, 1, 1);
     return(Task.FromResult(item));
 }