Ejemplo n.º 1
0
        public async Task <TResponse <PageResult <TaskStatusModel> > > GetPaging(int userId,
                                                                                 GetTaskStatusPageModel request,
                                                                                 int permissionId)
        {
            try
            {
                var checkValid = await _userService.CheckPermission(userId,
                                                                    permissionId);

                if (checkValid.IsSuccess)
                {
                    var taskStatuses = await _taskStatusCacheService.GetList();

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

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

                return(await Fail <PageResult <TaskStatusModel> >(checkValid.Message));
            }
            catch (Exception exception)
            {
                return(await Fail <PageResult <TaskStatusModel> >(exception));
            }
        }
Ejemplo n.º 2
0
        private async Task LoadTaskStatuses(bool firstLoad)
        {
            var taskStatuses = await _taskStatusCacheService.GetList(firstLoad);

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