コード例 #1
0
ファイル: BaseController.cs プロジェクト: yagqfhd/fd
        public virtual async Task <IHttpActionResult> list([FromBody] QueryPageInput page)
        {
            #region /// 检查输入信息正确性
            if (!ModelState.IsValid)
            {
                return(Ok(new ApiResultModel <PagedResult <TDTO> >(this.GetModelStateError(ModelState))));
            }
            #endregion
            try
            {
                var result = await Service.PageQueryable(page.skip, page.limit, page.order, page.filter);

                var dtoResult = new PagedResult <TDTO>(result.TotalRecords, result.TotalPages, result.PageSize, result.PageNumber, DTOMap.Map <List <TDTO> >(result.Data));
                return(Ok(new ApiResultModel <PagedResult <TDTO> >(dtoResult)));
            }
            catch (DataAccessException ex)
            {
                return(Ok(new ApiResultModel <PagedResult <TDTO> >(ex.Message)));
            }
            catch (BusinessException ex)
            {
                return(Ok(new ApiResultModel <PagedResult <TDTO> >(ex.Message)));
            }
            catch (ComponentException ex)
            {
                return(Ok(new ApiResultModel <PagedResult <TDTO> >(ex.Message)));
            }
        }
コード例 #2
0
 public override Task <IHttpActionResult> list([FromBody] QueryPageInput page)
 {
     return(base.list(page));
 }