public async Task <TResponse <PageResult <TaskTypeModel> > > GetPaging(int userId,
                                                                               GetTaskTypePageModel request,
                                                                               int permissionId)
        {
            try
            {
                var checkValid = await _userService.CheckPermission(userId,
                                                                    permissionId);

                if (checkValid.IsSuccess)
                {
                    var taskTypes = await _taskTypeCacheService.GetList();

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

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

                return(await Fail <PageResult <TaskTypeModel> >(checkValid.Message));
            }
            catch (Exception exception)
            {
                return(await Fail <PageResult <TaskTypeModel> >(exception));
            }
        }
Exemple #2
0
        private async Task LoadTaskTypes(bool firstLoad)
        {
            var taskTypes = await _taskTypeCacheService.GetList(firstLoad);

            _logger.Info($"Load {taskTypes.Count} task types from redis cache");
        }