public async Task <TEntity> Add(TEntity entity)
        {
            await Context.Set <TEntity>().AddAsync(entity);

            await Context.SaveChangesAsync();

            return(entity);
        }
 public override async Task <List <Student> > GetAll()
 {
     try
     {
         return(await _context.Set <Student>().Include(p => p.StudentSubjects).ToListAsync());
     }
     catch (Exception ex)
     {
         //todo: log exception
         throw;
     }
 }
Пример #3
0
        public BaseRepository(AbcSchoolDbContext context)
        {
            this.context = context;

            this.dbSet = context.Set <T>();
        }