public virtual T FindById(int id) { using (var context = new PharmacyContext()) { return(context.Set <T>().Find(id)); } }
public virtual List <T> FindAll() { using (var context = new PharmacyContext()) { return(context.Set <T>().ToList()); } }
public virtual void Delete(T entry) { using (var context = new PharmacyContext()) { context.Set <T>().Remove(entry); context.SaveChanges(); } }
public virtual void AddRange(IEnumerable <T> entries) { using (var context = new PharmacyContext()) { context.Set <T>().AddRange(entries); context.SaveChanges(); } }
public virtual void Add(T entry) { using (var context = new PharmacyContext()) { context.Set <T>().Add(entry); context.SaveChanges(); } }
public async Task Add(T entity) { await _context.Set <T>().AddAsync(entity); await _context.SaveChangesAsync(); }