đ± Mobile Device Details View Documentation
Welcome to the comprehensive documentation for the IrbyImaging/Views/MobileDevices/Details.cshtml Razor view. This guide covers everything from an overview of its purpose to detailed breakdowns of its key areas, dependencies, viewâmodel structure, thirdâparty integrations, sample code snippets, and even a UML class diagram.
Table of Contents
- Overview & Purpose
- Key Functional Areas
- Dependencies & Technologies
- View Model:
MobileDeviceDetailViewModel - Razor View Structure
- Tag Helpers & Routing
- Styling & CSS Classes
- Thirdâparty Integrations
- Sample Usage & Code Snippets
- UML Class Diagram
- Conclusion
Overview & Purpose
File Path: IrbyImaging/Views/MobileDevices/Details.cshtml
Purpose:
This Razor view renders a detailed, readâonly page for a single mobile device in the system. It presents all relevant propertiesâsuch as serial number, carrier, warranty status, owner details, and notesâin a clean, userâfriendly format.
đ Use Case:
When a user clicks âDetailsâ on a mobile device listing, the MVC controller returns the MobileDeviceDetailViewModel to this view, which then displays each property with appropriate styling and navigation links.
Key Functional Areas
| Section | Description |
|---|---|
| Page Setup | Defines the view model, title, and layout. |
| Header | Mobile device name + status badge. |
| Details List | A <dl> (description list) with labels and values for each device attribute. |
| Owner Link | Clickable link to the employee who owns the device. |
| Action Buttons | âIndexâ, âUpdateâ, and âHistoryâ buttons for further navigation. |
| Scripts | Includes JS bundles for Bootstrap, menu, scrollbars, and waves effects. |
Dependencies & Technologies
- ASP.NET Core MVC / Razor
- Tag Helpers (
asp-controller,asp-action,asp-route-id) - Bootstrap 5 for grid, typography, buttons, badges.
- MetisMenu, SimpleBar, Node-Waves for UI behavior.
- Shared layout:
~/Views/Shared/_ATSLayout.cshtml
View Model: MobileDeviceDetailViewModel
This view expects a strongly typed model:
public class MobileDeviceDetailViewModel
{
public int Id { get; set; }
public string MakeAndModel { get; set; }
public string Type { get; set; }
public string SerialNumber { get; set; }
public string Carrier { get; set; }
public string PhoneNumber { get; set; }
public string Imei { get; set; }
public string Sim { get; set; }
public DateTime PurchaseDate { get; set; }
public DateTime EndOfWarranty { get; set; }
public bool IsTelogis { get; set; }
public bool NeedsReview { get; set; }
public string Status { get; set; }
public string StatusColor { get; set; } // CSS badge class
public string WarrantyColorClass { get; set; } // CSS class for warranty field
public int OwnerId { get; set; }
public string OwnerFullName { get; set; }
public string Notes { get; set; }
}
Razor View Structure
@model MobileDeviceDetailViewModel
@{
ViewData["Title"] = "Mobile Device Details";
Layout = "~/Views/Shared/_ATSLayout.cshtml";
}
<h2>
@Html.DisplayFor(m => m.MakeAndModel)
<span class="badge @Model.StatusColor">@Model.Status</span>
</h2>
<div>
<h4>Asset ID: @Model.Id</h4>
<hr />
<dl class="dl-horizontal">
<!-- Loop of field labels & values -->
<dt>@Html.DisplayNameFor(m => m.Type)</dt>
<dd>@Html.DisplayFor(m => m.Type)</dd>
<!-- ... other <dt>/<dd> pairs ... -->
<dt>@Html.DisplayNameFor(m => m.EndOfWarranty)</dt>
<dd class="@Model.WarrantyColorClass">
@Html.DisplayFor(m => m.EndOfWarranty)
</dd>
<!-- Owner link -->
<dt>@Html.DisplayNameFor(m => m.OwnerFullName)</dt>
<dd>
<a asp-controller="Employees"
asp-action="Details"
asp-route-id="@Model.OwnerId">
@Model.OwnerFullName
</a>
</dd>
<!-- Notes -->
<dt>@Html.DisplayNameFor(m => m.Notes)</dt>
<dd><pre>@Model.Notes</pre></dd>
</dl>
</div>
<div class="action-buttons">
<a asp-action="Index" class="btn btn-danger irby-red">Index List</a>
<a asp-action="Edit"
asp-route-id="@Model.Id"
class="btn btn-warning irby-orange">Update</a>
<a asp-action="History"
asp-route-id="@Model.Id"
class="btn btn-primary irby-violet">History</a>
</div>
<!-- Scripts -->
<script src="~/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="~/libs/metismenu/metisMenu.min.js"></script>
<script src="~/libs/simplebar/simplebar.min.js"></script>
<script src="~/libs/node-waves/waves.min.js"></script>
Tag Helpers & Routing
asp-action="Details"&asp-route-id="@Model.Id"
Generates a link to theDetails(int id)action in the current controller (MobileDevicesby convention).- Owner Link:
Navigates to an employeeâs detail page.<a asp-controller="Employees" asp-action="Details" asp-route-id="@Model.OwnerId"> @Model.OwnerFullName </a>
Styling & CSS Classes
| Class Name | Purpose |
|---|---|
badge |
Bootstrap badge container |
@Model.StatusColor |
Dynamically sets badge background color |
.dl-horizontal |
Horizontal <dt>/<dd> styling group |
.irby-red |
Custom red button styling |
.irby-orange |
Custom orange button styling |
.irby-violet |
Custom violet button styling |
@Model.WarrantyColorClass |
Highlights warranty end date |
Thirdâparty Integrations
- Bootstrap: Layout, grid, typography, buttons, badges.
- MetisMenu: Collapsible sidebar menus.
- SimpleBar: Custom scrollbars.
- Node-Waves: Click-wave (ripple) effect on elements.
Sample Usage & Code Snippets
Controller Action
public IActionResult Details(int id)
{
var model = _deviceService.GetDeviceDetails(id);
if (model == null)
return NotFound();
return View(model);
}
Route Example
GET /MobileDevices/Details/42
Renders the view above with Model.Id == 42.
UML Class Diagram
classDiagram
class MobileDeviceDetailViewModel {
+int Id
+string MakeAndModel
+string Type
+string SerialNumber
+string Carrier
+string PhoneNumber
+string Imei
+string Sim
+DateTime PurchaseDate
+DateTime EndOfWarranty
+bool IsTelogis
+bool NeedsReview
+string Status
+string StatusColor
+string WarrantyColorClass
+int OwnerId
+string OwnerFullName
+string Notes
}
Conclusion
You now have an inâdepth view of the Details.cshtml Razor page:
- Purpose: Display a mobile deviceâs full details.
- Key Features: Readâonly layout, dynamic badges, description lists, navigation links.
- Dependencies: ASP.NET Core MVC, Bootstrap, MetisMenu, SimpleBar, NodeâWaves.
- Extensibility: Easily add more
<dt>/<dd>fields or adjust styling classes.
With this knowledge, you can confidently maintain, extend, and style this view to match evolving business requirements. đ
Authored by: Your Friendly Documentation Bot đ