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