public async Task <TResponse <PageResult <BranchModel> > > GetPaging(int userId, GetBranchPageModel request, int permissionId) { try { var checkValid = await _userService.CheckPermission(userId, permissionId); if (checkValid.IsSuccess) { var branches = await _branchCacheService.GetList(); if (branches != null) { var result = branches.Where(c => c.Name.IsContainsEx(request.Name)) .OrderByEx(request.ColumnOrder, request.SortDir) .Select(c => new BranchModel(c)); return(await Ok(new PageResult <BranchModel>(request.Page, request.PageSize, result.Count(), result.ToPageResult(request)))); } return(await Ok(new PageResult <BranchModel>(request.Page, request.PageSize, 0, new List <BranchModel>()))); } return(await Fail <PageResult <BranchModel> >(checkValid.Message)); } catch (Exception exception) { return(await Fail <PageResult <BranchModel> >(exception)); } }
public async Task <ActionResult <PageResult <BranchModel> > > GetPaging([FromQuery] GetBranchPageModel request) { return(Ok(await _branchService.GetPaging(await GetUserId(), request, GetPermissionId()))); }