예제 #1
0
 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));
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 /// <summary>
 /// 获取UsersQueryable集合
 /// </summary>
 /// <returns>匹配的Lambda表达式</returns>
 public IQueryable <TModel> Get(Expression <Func <TModel, bool> > WhereLambda)
 {
     return(CurrentDal.Get(WhereLambda));
 }