Example #1
0
        public Team GetById(int id)
        {
            var team = _dbContext.Set <Team>().SingleOrDefault(x => x.Id == id);

            if (team == null)
            {
                throw new ApplicationException("The team is not found");
            }
            return(team);
        }
        public Player GetById(int id)
        {
            var player = _dbContext.Set <Player>().Find(id);

            if (player == null)
            {
                throw new ApplicationException("The player is not found");
            }
            return(player);
        }
 public GenericRepository(PremierLeagueContext context)
 {
     this._Context = context;
     entities      = context.Set <T>();
 }
 public void Add(Coach entity)
 {
     _dbContext.Set <Coach>().Add(entity);
     _dbContext.SaveChanges();
 }