public IEnumerable <TEntity> GetAll() { using (var context = new NorthwindContext()) { return(context.Set <TEntity>().Take(100).ToList()); } }
public TEntity GetById(int id) { using (var context = new NorthwindContext()) { return(context.Set <TEntity>().Find(id)); } }
public TEntity Add(TEntity entity) { using (var context = new NorthwindContext()) { var createdEntity = context.Set <TEntity>().Add(entity); context.SaveChanges(); return(createdEntity); } }