Exemple #1
0
        public async Task <PlayerMatchEntity> AddAsync(PlayerMatchEntity entity)
        {
            var response = await dbContext.PlayerMatch.AddAsync(entity);

            await dbContext.SaveChangesAsync();

            return(response.Entity);
        }
Exemple #2
0
        public async Task <PlayerMatchEntity> UpdateAsync(PlayerMatchEntity entity)
        {
            var existing = await dbContext.FindAsync <PlayerMatchEntity>(entity.ID); // Pass by reference

            if (existing is null)
            {
                return(null);
            }

            dbContext.Entry(existing).CurrentValues.SetValues(entity);
            await dbContext.SaveChangesAsync();

            return(existing);
        }