Kind: Class
Source: Pams/Logic/Pams.Business/Entity/Common/Category.Model.cs (line 14)
Part of: Pams
Category is a C# entity model for storing category records and their parent-child relationships. It supports optional company scoping through CompanyId and represents hierarchy through ParentId and HasChilds.
Diagram
mermaidgraph LR Category[Category] Category --> Id[Id: long] Category --> CompanyId[CompanyId: int?] Category --> ParentId[ParentId: long?] Category --> CategoryName[CategoryName: string] Category --> ReferenceNo[ReferenceNo: string] Category --> HasChilds[HasChilds: bool] ParentId --> ParentCategory[Parent Category] CompanyId --> Company[Company]
Usage
tstype Category = {
id: number;
companyId: number | null;
parentId: number | null;
categoryName: string;
referenceNo: string;
hasChilds: boolean;
};
const category: Category = {
id: 100,
companyId: 10,
parentId: null,
categoryName: "Office Supplies",
referenceNo: "OFFICE",
hasChilds: true,
};
async function createCategory(category: Category) {
const response = await fetch("/api/categories", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(category),
});
return response.json();
}
createCategory(category);
AI Coding Instructions
- Preserve the
HasChildsproperty name when mapping API payloads, even though it differs from the usualHasChildrenspelling. - Treat
CompanyIdandParentIdas nullable values when creating or updating categories. - Use
ParentIdto represent category hierarchy; usenullfor a root category. - Keep
HasChildsconsistent with the presence of child category records when category trees are created or updated. - Map C# PascalCase property names to the API naming convention used by the application.
Relationships
- IMPORTS →
CategoryPrincipal - IMPORTS →
CategoryPrincipalBindingModel - IMPORTS →
Category - IMPORTS →
EntityBase - IMPORTS →
PamsLinqDataContext
Used by
14 references from 14 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (14)
BookingTargetController—Pams/API/Pams.API/Controllers/Common/BookingTargetController.cs:28LostReasonController—Pams/API/Pams.API/Controllers/Common/LostReasonController.cs:29MarketSegmentController—Pams/API/Pams.API/Controllers/Common/MarketSegmentController.cs:21CanceledController—Pams/API/Pams.API/Controllers/Sales/CanceledController.cs:26DeliveredController—Pams/API/Pams.API/Controllers/Sales/DeliveredController.cs:26InquiryController—Pams/API/Pams.API/Controllers/Sales/InquiryController.cs:48OfferController—Pams/API/Pams.API/Controllers/Sales/OfferController.cs:23OrderController—Pams/API/Pams.API/Controllers/Sales/OrderController.cs:23
…and 6 more.
Was this page helpful?