public TEntity Get(Guid id) { return(Context.Set <TEntity>().SingleOrDefault(_ => _.Id == id)); }
protected RepositoryBase(UniversityDbContext context) { Context = context; _dbSet = context.Set <TEntity>(); }
public IEnumerable <T> GetAll() { return(dbContext.Set <T>().ToList()); }
public async Task AddAsync(T model) { dbContext.Set <T>().Add(model); await dbContext.SaveChangesAsync(); }
public Task <TEntity> FirstOrDefaultAsync(int id) { return(_context.Set <TEntity>().FirstOrDefaultAsync(x => x.Id == id)); }