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); }
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); }
public void Delete <T>(T entity) where T : class { _logger.LogInformation($"Removing an object of type {entity.GetType()} to the context."); _context.Remove(entity); }