Skip to content

DeleteDto

reference
1 min readUpdated

Kind: Class

Source: Pams/Logic/Pams.Business/BindingModels/DeleteDto.cs (line 3)

Part of: Pams

DeleteDto carries the identifiers and context needed to delete an entity or a related set of entities. It includes object, company, stage, parent, vendor, user, and item-list data so the receiving service can scope the delete operation.

Diagram

mermaid
graph LR
    Client[Client request] --> DTO[DeleteDto]
    DTO --> ID[ID]
    DTO --> User[UserId]
    DTO --> Object[ObjectId / ObjectTypeId / ObjectTitle]
    DTO --> Context[CompanyId / StageId / ParentId]
    DTO --> Vendor[LocalVendorId]
    DTO --> Items[ItemsIdList]
    DTO --> DeleteService[Delete handler]

Usage

ts
type DeleteDto = {
  ID: string;
  UserId: string;
  ObjectId: number;
  CompanyId: number;
  StageId: number;
  ParentId: string;
  ObjectTypeId: number;
  ObjectTitle: string;
  LocalVendorId: string;
  ItemsIdList: string[];
};

async function deleteObject(endpoint: string, dto: DeleteDto) {
  const response = await fetch(endpoint, {
    method: "DELETE",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(dto),
  });

  if (!response.ok) {
    throw new Error("Delete request failed.");
  }
}

const request: DeleteDto = {
  ID: selectedRecord.id,
  UserId: currentUser.id,
  ObjectId: selectedRecord.objectId,
  CompanyId: selectedRecord.companyId,
  StageId: selectedRecord.stageId,
  ParentId: selectedRecord.parentId,
  ObjectTypeId: selectedRecord.objectTypeId,
  ObjectTitle: selectedRecord.title,
  LocalVendorId: selectedRecord.localVendorId,
  ItemsIdList: selectedItemIds,
};

await deleteObject(deleteEndpoint, request);

AI Coding Instructions

  • Keep property names aligned with the C# model, including ID and ItemsIdList.
  • Preserve long values safely across the API boundary; send them as strings when JavaScript number precision may be an issue.
  • Populate CompanyId, StageId, and ObjectTypeId from the selected entity context before sending a delete request.
  • Send ItemsIdList when the delete operation applies to related items, and avoid sending unrelated item identifiers.

Relationships

  • IMPORTS → UserLogResultBindingModel

Used by

83 references from 83 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (83)

  • AddressControllerPams/API/Pams.API/Controllers/Common/AddressController.cs:15
  • BankAccountControllerPams/API/Pams.API/Controllers/Common/BankAccountController.cs:9
  • BankControllerPams/API/Pams.API/Controllers/Common/BankController.cs:9
  • CategoryControllerPams/API/Pams.API/Controllers/Common/CategroyController.cs:15
  • ClientTypeControllerPams/API/Pams.API/Controllers/Common/ClientTypeController.cs:19
  • ColorMarkerControllerPams/API/Pams.API/Controllers/Common/ColorMarkerController.cs:9
  • ContactPersonControllerPams/API/Pams.API/Controllers/Common/ContactPersonController.cs:17
  • CostItemControllerPams/API/Pams.API/Controllers/Common/CostItemController.cs:8

…and 75 more.

Was this page helpful?

Download as PDF