From 4dc37cb0ac986e1af439442a77d3e87f67bf265b Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Tue, 14 Oct 2025 16:55:46 +0530 Subject: [PATCH] Added the projectID filter in get invoice list API --- Marco.Pms.Services/Controllers/CollectionController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Marco.Pms.Services/Controllers/CollectionController.cs b/Marco.Pms.Services/Controllers/CollectionController.cs index 9cbd38c..dd829b2 100644 --- a/Marco.Pms.Services/Controllers/CollectionController.cs +++ b/Marco.Pms.Services/Controllers/CollectionController.cs @@ -50,7 +50,7 @@ namespace Marco.Pms.Services.Controllers #region =================================================================== Get Functions =================================================================== [HttpGet("invoice/list")] - public async Task GetInvoiceListAsync([FromQuery] string? searchString, [FromQuery] DateTime? fromDate, [FromQuery] DateTime? toDate, [FromQuery] int pageSize = 20, [FromQuery] int pageNumber = 1 + public async Task GetInvoiceListAsync([FromQuery] Guid? projectId, [FromQuery] string? searchString, [FromQuery] DateTime? fromDate, [FromQuery] DateTime? toDate, [FromQuery] int pageSize = 20, [FromQuery] int pageNumber = 1 , [FromQuery] bool isActive = true, [FromQuery] bool isPending = false) { _logger.LogInfo( @@ -83,6 +83,13 @@ namespace Marco.Pms.Services.Controllers _logger.LogDebug("Applied search filter with term: {SearchString}", searchString); } + // Apply project filter + if (projectId.HasValue) + { + invoicesQuery = invoicesQuery.Where(i => i.ProjectId == projectId.Value); + _logger.LogDebug("Applied project filter with term: {ProjectId}", projectId); + } + // Get total count before pagination var totalEntites = await invoicesQuery.CountAsync(); _logger.LogDebug("Total matching invoices: {TotalCount}", totalEntites);