public async Task <PageList <AppDto> > GetUserAppsAsync(Int32 userId, String searchText, Int32 appTypeId, Int32 appStyleId, String appState, Int32 pageIndex, Int32 pageSize) { Check.IfNullOrZero(userId, true); Check.IfNullOrZero(appTypeId, true); Check.IfNullOrZero(appStyleId, true); Check.IfNullOrZero(pageIndex); Check.IfNullOrZero(pageSize); return(await Task.Run(async() => { var result = _appContext.GetUserApps(userId, searchText, appTypeId, appStyleId, appState, pageIndex, pageSize, out var totalCount); var appTypes = await GetAppTypesAsync(); return new PageList <AppDto> { TotalCount = totalCount, Models = result.Select(app => new AppDto { Name = app.Name, AppStyle = app.AppStyle, AppTypeName = appTypes.FirstOrDefault(appType => appType.Id == app.AppTypeId).Name, UseCount = app.UseCount, Id = app.Id, IconUrl = app.IconUrl, AppAuditState = app.AppAuditState, IsRecommand = app.IsRecommand, UserId = app.UserId, IsIconByUpload = app.IsIconByUpload }).ToList() }; })); }