public void Delete(Product product) { if (Context.Entry(product).State == EntityState.Detached) { Dbset.Attach(product); } Dbset.Remove(product); }
public Task <int> DeleteHash(int id) { var result = Dbset.Where(x => x.Id == id); Dbset.Remove(result.FirstOrDefault()); Context.SaveChanges(); return(null); }
public virtual void Delete(Expression <Func <T, bool> > where) { IEnumerable <T> objects = Dbset.Where <T>(where).AsEnumerable(); foreach (T obj in objects) { Dbset.Remove(obj); } }
public async Task DeleteAsync(int id) { var job = await GetAsync(id); if (job != null && job.IsFinished()) { Dbset.Remove(job); } }
public async Task DeleteAsync(int id) { var record = await Dbset.FirstOrDefaultAsync(r => r.RuleSetId == id); if (record != null) { Dbset.Remove(record); } }
public virtual void DeleteAllForSeries(int seriesId, string userId) { var objects = Dbset.Where(x => x.UserId == userId && x.Comic.SeriesId == seriesId).ToList(); foreach (var obj in objects) { Dbset.Remove(obj); } }
public async Task DeleteAsync(int ruleId, int ruleSetId) { var entity = await Dbset.FirstOrDefaultAsync(e => e.RuleId == ruleId && e.RuleSetId == ruleSetId); if (entity != null) { Dbset.Remove(entity); } }
public virtual void Delete(Expression <Func <TEntity, bool> > @where, Action <TEntity> action) { var objects = Dbset.Where(where); foreach (TEntity entity in objects) { action(entity); Dbset.Remove(entity); } }
/// <summary> /// 删除单条数据 /// </summary> /// <param name="id">实体编号</param> /// <exception cref="System.Data.Entity.Core.ObjectNotFoundException">entity</exception> public virtual void Delete(int id) { var entity = Get(m => m.Id == id); if (entity == null) { throw new ObjectNotFoundException("entity"); } Dbset.Remove(entity); }
public async Task DeleteAsync(int ruleSetId) { var records = await Dbset.Where(r => r.RuleSetId == ruleSetId).OrderBy(r => r.OrderId).ToListAsync(); if (records != null) { foreach (var entity in records) { Dbset.Remove(entity); } } }
public virtual void Delete(T entity) { Dbset.Remove(entity); }
public void Deletar(TEntity t) { Dbset.Remove(t); Context.SaveChanges(); }
/// <summary> /// 根据id删除数据 /// </summary> /// <param name="id"></param> public void Remove(Guid id) { Dbset.Remove(Dbset.Find(id)); }