đ§ LeaseController Documentation
QUICK DOCUMENTATIONâ
- File Path:
/API/Controllers/LeaseController.cs - Primary Purpose: Manages property lease information including creating, updating, deleting, and querying lease data
- Key Endpoints:
- đ
GET /api/Lease/List: Retrieves a list of leases based on search criteria - đ
GET /api/Lease/Get: Retrieves details of a specific lease - đ
POST /api/Lease/Update: Creates or updates lease information - âī¸
POST /api/Lease/Import: Imports lease data from a spreadsheet
- đ
- Related Models:
LeaseDto: Represents a property leaseLeaseContactDto: Represents contact information for lease parties
- Used By:
- Property management functionality in the APV system
- Lease reporting and analysis features
đ Business Contextâ
The LeaseController extends Asset Valuer Pro's functionality beyond pure valuation to include property management capabilities. This supports clients who need to track lease agreements for their assets, particularly for income-producing properties that might be valued using the income approach mentioned in the Overview document.
DETAILED DOCUMENTATIONâ
đ Overviewâ
LeaseController provides endpoints for managing property lease information within Asset Valuer Pro. It supports the full CRUD lifecycle for leases, as well as specialized operations like contact management and lease import/export functionality. This controller handles both tenant and landlord information, as well as internal and external property manager details.
đī¸ Controller Dependenciesâ
- Namespace:
AVP.API.Controllers - Services Used:
Mediator: For handling commands and queries
- Other Dependencies:
- Inherits from
ApiController
- Inherits from
đ Endpointsâ
đ List Leasesâ
- HTTP Method: GET
- URL Pattern:
/api/Lease/List - Authentication: đ Required (inherited from ApiController)
- Description: Retrieves a list of leases based on search criteria
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | SearchLeasesQuery | Yes | Search parameters for filtering leases |
Response Formatâ
[
{
"id": "integer",
"propertyId": "string",
"propertyName": "string",
"tenantName": "string",
"startDate": "date",
"endDate": "date",
"status": "string",
"rentalAmount": "decimal",
"contactDetails": { ... }
}
]
đ List Lease Contactsâ
- HTTP Method: GET
- URL Pattern:
/api/Lease/ListContacts - Authentication: đ Required (inherited from ApiController)
- Description: Retrieves contacts associated with leases
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetLeaseContactListQuery | Yes | Parameters for filtering contacts |
Response Formatâ
[
{
"id": "integer",
"leaseId": "integer",
"contactType": "string",
"name": "string",
"email": "string",
"phone": "string",
"address": "string"
}
]
đ Get Leaseâ
- HTTP Method: GET
- URL Pattern:
/api/Lease/Get - Authentication: đ Required (inherited from ApiController)
- Description: Retrieves detailed information for a specific lease
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetLeaseQuery | Yes | Identifies the lease to retrieve |
Response Formatâ
{
"id": "integer",
"propertyId": "string",
"propertyName": "string",
"tenantName": "string",
"startDate": "date",
"endDate": "date",
"status": "string",
"rentalAmount": "decimal",
"leaseType": "string",
"renewalOptions": "string",
"paymentTerms": "string",
"contacts": [ ... ],
"additionalDetails": { ... }
}
đ Update Leaseâ
- HTTP Method: POST
- URL Pattern:
/api/Lease/Update - Authentication: đ Required (inherited from ApiController)
- Description: Creates a new lease or updates an existing one
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | UpdateLeaseCommand | Yes | Lease data to create/update |
Response Formatâ
integer // ID of the created/updated lease
đ Export Leasesâ
- HTTP Method: POST
- URL Pattern:
/api/Lease/Export - Authentication: đ Required (inherited from ApiController)
- Description: Exports lease data to a file format
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | ExportLeasesQuery | Yes | Parameters for the export operation |
Response Formatâ
File download with lease data in specified format.
đī¸ Delete Leaseâ
- HTTP Method: POST
- URL Pattern:
/api/Lease/Delete - Authentication: đ Required (inherited from ApiController)
- Description: Deletes a specific lease
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | DeleteLeaseCommand | Yes | Identifies the lease to delete |
Response Formatâ
integer // Number of records affected
đī¸ Bulk Delete Leasesâ
- HTTP Method: POST
- URL Pattern:
/api/Lease/BulkDelete - Authentication: đ Required (inherited from ApiController)
- Description: Deletes multiple leases in a single operation
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | DeleteLeasesCommand | Yes | Identifies the leases to delete |
Response Formatâ
{
"message": "string" // Result of the operation
}
đī¸ Remove Lease Contactâ
- HTTP Method: POST
- URL Pattern:
/api/Lease/RemoveLeaseContact - Authentication: đ Required (inherited from ApiController)
- Description: Removes a contact from a lease
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | RemoveLeaseContactCommand | Yes | Identifies the contact to remove |
Response Formatâ
string // Result message
âī¸ Import Leasesâ
- HTTP Method: POST
- URL Pattern:
/api/Lease/Import - Authentication: đ Required (inherited from ApiController)
- Description: Imports lease data from a spreadsheet
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | ImportLeaseSpreadsheetCommand | Yes | Import parameters and file |
Response Formatâ
{
"success": "boolean",
"message": "string",
"importedCount": "integer",
"errors": [ "string" ]
}
âī¸ Add/Update Contactsâ
The controller includes endpoints for adding and updating different types of lease contacts:
- âī¸
/api/Lease/AddLandlord - âī¸
/api/Lease/AddInternalPropertyManager - âī¸
/api/Lease/AddExternalPropertyManager - đ
/api/Lease/UpdateLandlord - đ
/api/Lease/UpdateInternalPropertyManager - đ
/api/Lease/UpdateExternalPropertyManager
Each of these endpoints accepts a command object specific to the contact type and returns a status message.
đĄ Implementation Notesâ
- âšī¸ The controller uses a consistent pattern of delegating to the Mediator for handling commands and queries
- đ Import/export functionality supports data exchange with external systems
- đĨ Contact management is separated into different contact types with specialized operations
- đ The controller returns different response types depending on the operation, including direct values, status messages, and file downloads