fix handle inactive items

This commit is contained in:
2026-09-04 13:07:22 +05:30
parent dfd51b8273
commit 712a163777
3 changed files with 8 additions and 4 deletions
+3 -1
View File
@@ -20,12 +20,14 @@ public class ItemRepository(AppDBContext context) : IItemRepository
public async Task<List<Models.Item>> GetAllAsync(Guid? categoryId = null, Guid? subCategoryId = null, Guid? brandId = null)
{
// Deleted items stay IsActive=false but remain visible with an Inactive status —
// Delete never removes the row, only marks it (same rule as Orders/Stores).
var query = context.Items
.Include(i => i.Category)
.Include(i => i.SubCategory)
.Include(i => i.Brand)
.Include(i => i.BaseUom)
.Where(i => i.IsActive);
.AsQueryable();
if (categoryId.HasValue) query = query.Where(i => i.FK_CategoryId == categoryId);
if (subCategoryId.HasValue) query = query.Where(i => i.FK_SubCategoryId == subCategoryId);