public override void Add(Coffee model) { model.OnAdd(); DBSet.Add(model); SaveChanges(); }
public virtual Task Insert(TEntity entity) { if (entity == null) { throw new ArgumentNullException("entity"); } DBSet.Add(entity); return(Context.SaveChangesAsync()); }
public virtual void Add(T entity) { DbEntityEntry entry = Context.Entry(entity); if (entry.State != EntityState.Detached) { entry.State = EntityState.Added; } else { DBSet.Add(entity); } }
public void Add(T entity) { DbEntityEntry entry = Context.Entry(entity); if (entry.State != EntityState.Detached) { entry.State = EntityState.Added; } else { DBSet.Add(entity); } Context.SaveChanges(); }
public TEntity Insert(TEntity entity) { return(DBSet.Add(entity)); }