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)); } }
public async Task <ActionResult <PageResult <TaskStatusModel> > > GetPaging([FromQuery] GetTaskStatusPageModel request) { return(Ok(await _taskStatusService.GetPaging(await GetUserId(), request, GetPermissionId()))); }