/// <summary> /// 根据一串ID在数据库中删除对应的全部数据对象 /// </summary> /// <param name="keys"></param> /// <returns></returns> public virtual int DeleteByKeys(IEnumerable keys) { if (typeof(ICanLogicalDeleteEntity).IsAssignableFrom(typeof(TEntity))) { var ids = keys.Each(key => CommOp.ToInt(key)).ToArray(); var logicalDeletedList = _innerDataProvider.GetQuery().Where(t => ids.Contains(t.Id)) .ToArray() .Each(t => { (t as ICanLogicalDeleteEntity).IsDeleted = true; }); return(_innerDataProvider.Change(logicalDeletedList)); } else { return(_innerDataProvider.DeleteByKeys(keys)); } }
public virtual ActionResult Delete(string ids) { _dataProvider.DeleteByKeys(CommOp.ToIntArray(ids, ',')); return(JsonTips("success", "删除成功!")); }