From 3e1758d35c523deffde73635d9ecac3a5dbd1ad9 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 25 May 2025 21:40:07 +0330 Subject: [PATCH] Optimise AMO Speed --- .../Repository/AdminMonthlyOverviewRepository.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/AdminMonthlyOverviewRepository.cs b/CompanyManagment.EFCore/Repository/AdminMonthlyOverviewRepository.cs index 99c7fbdf..8b26ebe2 100644 --- a/CompanyManagment.EFCore/Repository/AdminMonthlyOverviewRepository.cs +++ b/CompanyManagment.EFCore/Repository/AdminMonthlyOverviewRepository.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using _0_Framework.Application; @@ -25,6 +26,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase> GetWorkshopStatus(AdminMonthlyOverviewSearchModel searchModel) { + var year = searchModel.Year; var month = searchModel.Month; var accountId = searchModel.AdminAccountId; @@ -40,17 +42,15 @@ public class AdminMonthlyOverviewRepository : RepositoryBase c.ContractStartGr <= targetDate && c.ContractEndGr >= targetDate && c.IsActiveString == "true") - .Select(c => c.ContractingPartyId) - .ToListAsync(); + .Select(c => c.ContractingPartyId); // دریافت کارگاه‌های مرتبط با اکانت - var accountWorkshopIds = await _companyContext.WorkshopAccounts + var accountWorkshopIds = _companyContext.WorkshopAccounts .AsNoTracking() .Where(w => w.AccountId == accountId) - .Select(w => w.WorkshopId) - .ToListAsync(); + .Select(w => w.WorkshopId); // دریافت کارگاه‌های مربوط به طرف حساب و اکانت // Replace the selected code with the following to return a list of anonymous objects containing both workshop and contractingParty @@ -92,6 +92,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase x.IsBlock).ToList(); + return adminMonthlyOverviewList; }