📚 AssetsView.cs Documentation
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Key Functional Areas
- Data Models:
AssetsView&AssetsViewDetail - Property Breakdown
- UML Class Diagram
- Sample Code Blocks
- Usage Examples
- Error Handling & Return Types
- Third‑Party Integrations
- Conclusion
🔍 Overview & Purpose
AssetsView.cs lives in IrbyImaging.UI.Models and defines two view‑model classes:
- AssetsView
- AssetsViewDetail
These classes act as DTOs (Data Transfer Objects) between the back‑end and the Razor UI, encapsulating Asset and Owner information for display and interaction on the web pages.
Key goals
- Standardize how asset and employee data is passed to the UI.
- Provide a strongly‑typed model for Razor views, API responses, or JavaScript front‑end code.
🛠️ Dependencies & Technologies
| Dependency | Purpose |
|---|---|
System |
Core CLR types (e.g., Guid, DateTime) |
System.Collections.Generic |
Collection support (List<T>) |
System.Linq |
LINQ operations (if needed in future enhancements) |
System.Threading.Tasks |
Async support (scaffolded for future use) |
IrbyImaging.UI.Models namespace |
Houses all UI-specific view models |
Tip: These view models can be mapped from your domain/entities via AutoMapper or manual mapping in your service layer.
🔑 Key Functional Areas
- Data Aggregation
- Combines asset metadata and associated employee/office details into a single view model.
- UI Binding
- Enables Razor pages (or API endpoints) to strongly‑type their Model to
AssetsView.
- Enables Razor pages (or API endpoints) to strongly‑type their Model to
- Drill‑Down Details
AssetsView.AssetListholds a collection ofAssetsViewDetailitems for granular records.
🗂️ Data Models: AssetsView & AssetsViewDetail
1. AssetsView
- Represents a summary of an owner’s assets.
- Contains global owner information and a list of detailed assets.
2. AssetsViewDetail
- Provides per‑asset details, including office, manager, job, and termination specifics.
📋 Property Breakdown
AssetsView
| Property Name | Type | Description |
|---|---|---|
OwnerId |
Guid |
Unique identifier for the owner. |
Category |
string |
Category/type of the asset (e.g., Vehicle). |
PurchaseDate |
DateTime |
When the asset was acquired. |
Status |
string |
Current asset status (Active, Retired, etc.) |
SerialNumber |
string |
Manufacturer’s serial number. |
AssetNumber |
string |
Internal asset tracking number. |
CpsNumber |
string |
CPS reference number. |
Type |
string |
Sub‑type of the asset. |
ModelName |
string |
Asset model designation. |
Carrier |
string |
Telecom carrier (if applicable). |
PhoneNumber |
string |
Associated phone line. |
Imei |
string |
Device IMEI. |
Sim |
string |
SIM card identifier. |
IsTelogis |
bool |
Flag: is Telogis‑enabled? |
EmployeeNumber |
string |
Assigned employee ID. |
EmployeeName |
string |
Full employee name. |
FirstName |
string |
Employee first name. |
MiddleName |
string |
Employee middle name. |
LastName |
string |
Employee last name. |
Title |
string |
Employee job title. |
EmploymentStatus |
string |
Current employment status. |
TerminationDate |
DateTime |
End of employment (if any). |
AssetList |
List<AssetsViewDetail> |
Child asset records. |
AssetsViewDetail
| Property Name | Type | Description |
|---|---|---|
OwnerId |
Guid |
Owner’s unique ID. |
Category |
string |
Category/type of this specific asset. |
PurchaseDate |
DateTime |
Acquisition date. |
Status |
string |
Current state. |
SerialNumber |
string |
Serial number. |
AssetNumber |
string |
Asset tracking number. |
CpsNumber |
string |
CPS reference. |
Type |
string |
Sub‑type. |
ModelName |
string |
Model. |
Carrier |
string |
Telecom carrier. |
PhoneNumber |
string |
Phone line. |
Imei |
string |
IMEI. |
Sim |
string |
SIM identifier. |
IsTelogis |
bool |
Telogis flag. |
EmployeeNumber |
string |
Employee ID. |
EmployeeName |
string |
Employee full name. |
FieldOfficeNumber |
string |
Field office ID. |
FieldOfficeName |
string |
Office name. |
ManagerNumber |
string |
Manager’s employee ID. |
ManagerName |
string |
Manager’s name. |
FirstName |
string |
Employee first name. |
MiddleName |
string |
Employee middle name. |
LastName |
string |
Employee last name. |
Title |
string |
Position title. |
EmploymentStatus |
string |
Employment status. |
JobNumber |
string |
Associated job/project ID. |
JobName |
string |
Job/project name. |
TerminationDate |
DateTime? |
Nullable end of employment. |
🏗️ UML Class Diagram
classDiagram
class AssetsView {
+Guid OwnerId
+string Category
+DateTime PurchaseDate
+string Status
+string SerialNumber
+string AssetNumber
+string CpsNumber
+string Type
+string ModelName
+string Carrier
+string PhoneNumber
+string Imei
+string Sim
+bool IsTelogis
+string EmployeeNumber
+string EmployeeName
+string FirstName
+string MiddleName
+string LastName
+string Title
+string EmploymentStatus
+DateTime TerminationDate
+List~AssetsViewDetail~ AssetList
}
class AssetsViewDetail {
+Guid OwnerId
+string Category
+DateTime PurchaseDate
+string Status
+string SerialNumber
+string AssetNumber
+string CpsNumber
+string Type
+string ModelName
+string Carrier
+string PhoneNumber
+string Imei
+string Sim
+bool IsTelogis
+string EmployeeNumber
+string EmployeeName
+string FieldOfficeNumber
+string FieldOfficeName
+string ManagerNumber
+string ManagerName
+string FirstName
+string MiddleName
+string LastName
+string Title
+string EmploymentStatus
+string JobNumber
+string JobName
+DateTime? TerminationDate
}
AssetsView "1" --> "*" AssetsViewDetail : has
💻 Sample Code Blocks
C# Classes (Excerpt)
namespace IrbyImaging.UI.Models
{
public class AssetsView
{
public Guid OwnerId { get; set; }
public string Category { get; set; }
public DateTime PurchaseDate { get; set; }
// ... other properties ...
public List<AssetsViewDetail> AssetList { get; set; }
}
public class AssetsViewDetail
{
public Guid OwnerId { get; set; }
public string Category { get; set; }
public DateTime? TerminationDate { get; set; }
// ... other properties ...
}
}
JSON Representation
{
"OwnerId": "b3f9c3ae-6a5f-4b1b-9f4e-1a2d9a6de6e3",
"Category": "Vehicle",
"PurchaseDate": "2020-04-15T00:00:00",
"Status": "Active",
"AssetList": [
{
"AssetNumber": "A-1001",
"ModelName": "Ford F-150",
"ManagerName": "Jane Doe",
"TerminationDate": null
}
]
}
🚀 Usage Examples
1. Controller Action
public class AssetsController : Controller
{
public IActionResult Index()
{
// Normally fetched/mapped from your service layer
var viewModel = new AssetsView {
OwnerId = Guid.NewGuid(),
Category = "Laptop",
PurchaseDate = DateTime.UtcNow.AddYears(-2),
Status = "In Service",
AssetList = new List<AssetsViewDetail> {
new AssetsViewDetail {
AssetNumber = "L-2022",
ModelName = "Dell XPS 13",
ManagerName = "John Smith"
}
}
};
return View(viewModel);
}
}
2. Razor View (Index.cshtml)
@model IrbyImaging.UI.Models.AssetsView
<h2>Assets for @Model.EmployeeName</h2>
<table class="table">
<thead>
<tr><th>Asset #</th><th>Model</th><th>Status</th></tr>
</thead>
<tbody>
@foreach(var asset in Model.AssetList)
{
<tr>
<td>@asset.AssetNumber</td>
<td>@asset.ModelName</td>
<td>@Model.Status</td>
</tr>
}
</tbody>
</table>
⚠️ Error Handling & Return Types
- Validation: None built into these view models.
- Common Patterns:
- Check for
nullonAssetListbefore enumeration. - Use
DateTime?inAssetsViewDetail.TerminationDateto avoidDateTime.MinValueconfusion.
- Check for
🔗 Third‑Party Integrations
- AutoMapper (recommended)
- Map your EF Core entities →
AssetsView/AssetsViewDetail.
- Map your EF Core entities →
- Newtonsoft.Json / System.Text.Json
- Serialize/deserialize for AJAX calls or API endpoints.
🏁 Conclusion
The AssetsView and AssetsViewDetail classes form the backbone of your UI’s asset‑management pages. They:
- Provide a clear contract between controllers/services and views.
- Enable type‑safe rendering in Razor or JSON responses in Web APIs.
- Are easily extendable for additional fields or nested data.
With this documentation, you can confidently integrate, map, and display asset data across your IrbyImaging application! 🎉