コード例 #1
0
        public async Task <bool> RegisterUser(User user)
        {
            _iMDbContext.Users.Add(user);
            await _iMDbContext.SaveChangesAsync();

            return(true);
        }
コード例 #2
0
        public async Task <IActionResult> PutTitlebasics(string id, Titlebasics titlebasics)
        {
            if (id != titlebasics.Tconst)
            {
                return(BadRequest());
            }

            _context.Entry(titlebasics).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TitlebasicsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <bool> RegisterRate(MovieRate rate)
        {
            _iMDbContext.MovieRates.Add(rate);
            await _iMDbContext.SaveChangesAsync();

            return(true);
        }
コード例 #4
0
 public async Task InsertAssets(IEnumerable <AssetEntity> assetEntities)
 {
     foreach (var asset in assetEntities)
     {
         var currentAsset = imDbContext.Assets.AsQueryable().SingleOrDefault(a => a.AssetId == asset.AssetId);
         if (currentAsset == null)
         {
             logger.LogError($"AssetId can not be found {asset.AssetId}");
         }
         else if (currentAsset.TimeStamp > asset.TimeStamp)
         {
             logger.LogWarning($"Asset has smaller timestamp so skipping. AssetID : {asset.AssetId}");
         }
         else
         {
             imDbContext.Assets.Remove(currentAsset);
             imDbContext.Assets.Add(asset);
         }
     }
     await imDbContext.SaveChangesAsync();
 }
コード例 #5
0
        public async Task <bool> RegisterMovie(Movie movie)
        {
            movie.MoviesActors = new List <MoviesActors>();

            foreach (var actorID in movie.ActorsIDs)
            {
                var actor = _iMDbContext.Actors.First(x => x.ActorID == actorID);
                if (actor != null)
                {
                    var link = new MoviesActors()
                    {
                        Actor = actor, Movie = movie
                    };
                    movie.MoviesActors.Add(link);
                }
            }

            _iMDbContext.Movies.Add(movie);
            await _iMDbContext.SaveChangesAsync();

            return(true);
        }
コード例 #6
0
 public async Task InsertBatch(BatchEntity entity)
 {
     dbContext.Batches.Add(entity);
     await dbContext.SaveChangesAsync();
 }
コード例 #7
0
ファイル: Repository.cs プロジェクト: bufaonanet/Ioasys.IMDB
 public Task <int> SaveChanges()
 {
     return(_db.SaveChangesAsync());
 }