public async Task <ActionResult <PageResult <RecruitmentStatusModel> > > GetPaging([FromQuery] GetRecruitmentStatusPageModel request)
 {
     return(Ok(await _recruitmentStatusService.GetPaging(await GetUserId(),
                                                         request,
                                                         GetPermissionId())));
 }
        public async Task <TResponse <PageResult <RecruitmentStatusModel> > > GetPaging(int userId,
                                                                                        GetRecruitmentStatusPageModel request,
                                                                                        int permissionId)
        {
            try
            {
                var checkValid = await _userService.CheckPermission(userId,
                                                                    permissionId);

                if (checkValid.IsSuccess)
                {
                    var recruitmentStatuses = await _recruitmentStatusCacheService.GetList();

                    if (recruitmentStatuses != null)
                    {
                        var result = recruitmentStatuses.Where(c => c.Name.IsContainsEx(request.Name))
                                     .OrderByEx(request.ColumnOrder,
                                                request.SortDir)
                                     .Select(c => new RecruitmentStatusModel(c));
                        return(await Ok(new PageResult <RecruitmentStatusModel>(request.Page,
                                                                                request.PageSize,
                                                                                result.Count(),
                                                                                result.ToPageResult(request))));
                    }

                    return(await Ok(new PageResult <RecruitmentStatusModel>(request.Page,
                                                                            request.PageSize,
                                                                            0,
                                                                            new List <RecruitmentStatusModel>())));
                }

                return(await Fail <PageResult <RecruitmentStatusModel> >(checkValid.Message));
            }
            catch (Exception exception)
            {
                return(await Fail <PageResult <RecruitmentStatusModel> >(exception));
            }
        }