public async Task <Players> Remove(string id)
        {
            var player = await _teamContext.Players.SingleOrDefaultAsync(p => p.PlayerId == id);

            _teamContext.Remove(player);
            await _teamContext.SaveChangesAsync();

            return(player);
        }
예제 #2
0
        public async Task <ActionResult <Team> > DeleteTeam(long id)
        {
            var team = await _context.GetTeam(id);

            if (team == null)
            {
                return(NotFound());
            }

            await _context.Remove(id);

            await _context.SaveChangesAsync();

            return(team);
        }
예제 #3
0
 public void Delete <T>(T entity) where T : class
 {
     _logger.LogInformation($"Removing an object of type {entity.GetType()} to the context.");
     _context.Remove(entity);
 }