コード例 #1
0
        public async Task <TEntity> CreateAsync(TEntity entity)
        {
            var entityAdded = await _dbContext.AddAsync(entity);

            await Save();

            return(entityAdded.Entity);
        }
コード例 #2
0
        public async Task <GamePick> CreateAsync(Game game, User user)
        {
            GamePick gamePick = new GamePick()
            {
                Game   = game,
                GameId = game.Id,
                User   = user,
                UserId = user.Id
            };
            await _dbContext.AddAsync(gamePick);

            await _dbContext.SaveChangesAsync();

            return(gamePick);
        }