public async Task <TResponse <PageResult <CrmPriorityModel> > > GetPaging(int userId, GetCrmPriorityPageModel request, int permissionId) { try { var checkValid = await _userService.CheckPermission(userId, permissionId); if (checkValid.IsSuccess) { var crmPriorities = await _crmPriorityCacheService.GetList(); if (crmPriorities != null) { var result = crmPriorities.Where(c => c.Name.IsContainsEx(request.Name)) .OrderByEx(request.ColumnOrder, request.SortDir) .Select(c => new CrmPriorityModel(c)); return(await Ok(new PageResult <CrmPriorityModel>(request.Page, request.PageSize, result.Count(), result.ToPageResult(request)))); } return(await Ok(new PageResult <CrmPriorityModel>(request.Page, request.PageSize, 0, new List <CrmPriorityModel>()))); } return(await Fail <PageResult <CrmPriorityModel> >(checkValid.Message)); } catch (Exception exception) { return(await Fail <PageResult <CrmPriorityModel> >(exception)); } }
private async Task LoadCrmPriorities(bool firstLoad) { var crmPriorities = await _crmPriorityCacheService.GetList(firstLoad); _logger.Info($"Load {crmPriorities.Count} crm priorities from redis cache"); }