public async Task <T> AddAsync(T entity)
        {
            await _db.Set <T>().AddAsync(entity);

            await _db.SaveChangesAsync();

            return(entity);
        }
 TEntity IRepository <TEntity> .Get(int id)
 {
     return(Context.Set <TEntity>().Find(id));
 }
示例#3
0
 public void Add(T entity)
 {
     _context.Set <T>().Add(entity);
 }