public IDataResult <TEntity> GetById(int id) { try { var result = _baseDal.Get(x => x.Id == id); return(new SuccessDataResult <TEntity>(result)); } catch (Exception e) { return(new ErrorDataResult <TEntity>(e.Message)); } }
public async Task <IDataResult <TEntity> > GetById(int id) { IDataResult <TEntity> result; try { var entity = await _baseDal.Get(x => x.Id == id); result = new SuccessDataResult <TEntity>(entity, "Update was succesed"); } catch (Exception ex) { result = new SuccessDataResult <TEntity>(ex.Message); } return(result); }
/// <summary> /// 获取UsersQueryable集合 /// </summary> /// <returns>匹配的Lambda表达式</returns> public IQueryable <TModel> Get(Expression <Func <TModel, bool> > WhereLambda) { return(CurrentDal.Get(WhereLambda)); }