public virtual void Delete(T entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public virtual async Task <TEntity> Update(TEntity entity) { Context.Entry <TEntity>(entity).State = EntityState.Modified; //context.Update<TEntity>(entity); await Context.SaveChangesAsync(); return(entity); }