public async Task <T> AddAsync(T entity, CancellationToken cancellationToken = default) { await _dbContext.Set <T>().AddAsync(entity); await _dbContext.SaveChangesAsync(cancellationToken); return(entity); }
public async Task <T> AddAsync(T entity) { await _dbContext.Set <T>().AddAsync(entity); await _dbContext.SaveChangesAsync(); return(entity); }
public async Task <T> GetByIdAsync(int id) { return(await _eFContext.Set <T>().FindAsync(id)); }
public virtual T GetById(int id) { return(_dbContext.Set <T>().Find(id)); }
public T GetById(int id) { return(_dbContext.Set <T>().SingleOrDefault(e => e.Id == id)); }