Esempio n. 1
0
 public async Task <ActionResult <PageResult <CandidateStatusModel> > > GetPaging([FromQuery] GetCandidateStatusPageModel request)
 {
     return(Ok(await _candidateStatusService.GetPaging(await GetUserId(),
                                                       request,
                                                       GetPermissionId())));
 }
Esempio n. 2
0
        public async Task <TResponse <PageResult <CandidateStatusModel> > > GetPaging(int userId,
                                                                                      GetCandidateStatusPageModel request,
                                                                                      int permissionId)
        {
            try
            {
                var checkValid = await _userService.CheckPermission(userId,
                                                                    permissionId);

                if (checkValid.IsSuccess)
                {
                    var candidateStatuses = await _candidateStatusCacheService.GetList();

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

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

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