📄 Documentation: IrbyImaging/Views/JDE/Create.cshtml
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- View Model & Data Model
- Key Functional Areas
- 4.1 Page Setup
- 4.2 Form Rendering
- 4.3 Form Submission & Routing
- 4.4 Client‑Side Validation
- 4.5 UI Enhancements & Scripts
- Code Walkthrough
- Sample Usage & Workflow
- UML Diagram
- Conclusion
🔍 Overview & Purpose
Create.cshtml is an ASP.NET Core Razor view used to render the “New Field Office” creation page within the JDE (JD Edwards) module of the IrbyImaging application.
- 🏗️ Primary Function: Provide an HTML form for users to input details about a new Field Office (JDE Number, Name, Manager).
- 🛠️ Intended Use: Called by the JDEController’s
Createaction (HTTP GET to display, HTTP POST to process). - 🎯 Goal: Collect and validate user input, then submit to the server to persist a new
FieldOfficerecord.
🛠️ Dependencies & Technologies
| Layer | Technology / Library |
|---|---|
| Framework | ASP.NET Core MVC / Razor Pages |
| Styling | Bootstrap 5 |
| Navigation Menu | MetisMenu |
| Custom Scrollbars | SimpleBar |
| Click Effects | node-waves |
| Client-side Validation | jQuery Unobtrusive Validation |
| Layout | ~/Views/Shared/_ATSLayout.cshtml |
📋 View Model & Data Model
This view binds to the IrbyImaging.DomainClasses.FieldOffice model:
namespace IrbyImaging.DomainClasses
{
public class FieldOffice
{
public int Id { get; set; }
public string JdeNumber { get; set; } // Unique JDE code
public string Name { get; set; } // Office name
public int? ManagerId { get; set; } // FK to Employee table
public Employee Manager { get; set; } // Navigation property
// … other properties (CreatedDate, IsActive, etc.)
}
}
JdeNumber: Required, unique identifier in JDE.Name: Required, descriptive name.ManagerId: Dropdown selection fromViewBag.ManagerId(SelectList of available managers).
⚙️ Key Functional Areas
4.1 Page Setup
-
Layout & Title
@{ ViewData["Title"] = "Create"; Layout = "~/Views/Shared/_ATSLayout.cshtml"; }- Sets browser title to Create.
- Uses a shared layout for consistent UI.
-
Header
<h2>New Field Office</h2> <hr />
4.2 Form Rendering
The form uses ASP.NET Core Tag Helpers for strong typing and built‑in validation:
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<!-- JDE Number -->
<div class="form-group">
<label asp-for="JdeNumber" class="control-label"></label>
<input asp-for="JdeNumber" class="form-control" />
<span asp-validation-for="JdeNumber" class="text-danger"></span>
</div>
<!-- Name -->
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<!-- Manager Selection -->
<div class="form-group">
<label asp-for="Manager" class="control-label"></label>
<select asp-for="ManagerId" class="form-control"
asp-items="ViewBag.ManagerId">
</select>
</div>
<!-- Action Buttons -->
<div class="form-group">
<a asp-action="Index" class="btn btn-danger irby-red">Index List</a>
<input type="submit" value="Create" class="btn btn-success irby-green" />
</div>
</form>
4.3 Form Submission & Routing
-
HTTP GET
- Controller:
JDEController.Create() - Purpose: Populate
ViewBag.ManagerId, return emptyFieldOfficemodel.
- Controller:
-
HTTP POST
- Controller:
[HttpPost] JDEController.Create(FieldOffice model) - Model binding picks up
JdeNumber,Name,ManagerId. - On success: Redirect to
Index. - On validation failure: Redisplay form with errors.
- Controller:
4.4 Client‑Side Validation
- Validation Summary:
<div asp-validation-summary="ModelOnly" class="text-danger"></div> - Field‑Level:
<span asp-validation-for="Name" class="text-danger"></span> - Scripts:
Loads jQuery Unobtrusive and jQuery Validate scripts.@section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } }
4.5 UI Enhancements & Scripts
At the bottom of the page, additional scripts are loaded for UI:
<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>
- Bootstrap Bundle: Responsive layout & form styling.
- MetisMenu: Sidebar accordion menu.
- SimpleBar: Custom scrollbar for long menus.
- Waves: Ripple effect on button clicks.
🔍 Code Walkthrough
@model IrbyImaging.DomainClasses.FieldOffice
@{
ViewData["Title"] = "Create";
Layout = "~/Views/Shared/_ATSLayout.cshtml";
}
<h2>New Field Office</h2>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<!-- Validation summary -->
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<!-- JDE Number input -->
<div class="form-group">
<label asp-for="JdeNumber" class="control-label"></label>
<input asp-for="JdeNumber" class="form-control" />
<span asp-validation-for="JdeNumber" class="text-danger"></span>
</div>
<!-- Name input -->
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<!-- Manager dropdown -->
<div class="form-group">
<label asp-for="Manager" class="control-label"></label>
<select asp-for="ManagerId" class="form-control"
asp-items="ViewBag.ManagerId"></select>
</div>
<!-- Buttons -->
<div class="form-group">
<a asp-action="Index" class="btn btn-danger irby-red">Index List</a>
<input type="submit" value="Create" class="btn btn-success irby-green" />
</div>
</form>
</div>
</div>
<br /><br />
<!-- JAVASCRIPT for UI Plugins -->
<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>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
- Model Declaration (
@model): Binds the Razor view to theFieldOfficeclass. - Layout: Ensures consistent header, footer, and navigation.
- Form Tag Helpers: Simplify HTML generation and integrate seamlessly with model validation.
- Buttons:
- Index List: Navigates back to the list of existing Field Offices.
- Create: Submits the form.
🚀 Sample Usage & Workflow
- Navigate to
/JDE/Create– displays the empty form. - Fill out:
- JDE Number: e.g.
FO-1001 - Name: e.g.
Dallas Field Office - Manager: select from dropdown (populated via
ViewBag.ManagerId).
- JDE Number: e.g.
- Submit form by clicking Create.
- Redirect: On successful server‑side validation and save, you are redirected to the Index page.
- Handle Errors: If errors occur, they appear beneath the relevant fields.
📈 UML Diagram
+-------------------------------------+
| JDEController (Controller) |
+-------------------------------------+
| + Create(): IActionResult | <-- GET: returns Create.cshtml
| + Create(model: FieldOffice): IActionResult | <-- POST: handles form
| + Index(): IActionResult |
+-------------------------------------+
|
| Uses
v
+-------------------------------------+
| Create.cshtml (Razor View) |
+-------------------------------------+
| @model FieldOffice |
| Form fields: JdeNumber, Name, |
| ManagerId (select) |
+-------------------------------------+
|
| Binds to
v
+-------------------------------------+
| FieldOffice (Domain Class) |
+-------------------------------------+
| int Id |
| string JdeNumber |
| string Name |
| int? ManagerId |
| Employee Manager |
+-------------------------------------+
✅ Conclusion
The Create.cshtml view is a key component in the IrbyImaging JDE module, providing a user‑friendly interface to add new Field Office entries. Leveraging ASP.NET Core’s Tag Helpers and client‑side validation, it ensures a smooth data‑entry experience and helps maintain data integrity. The view is styled consistently via a shared layout and enriched with popular JS plugins for enhanced UI/UX.
Feel free to extend this page with additional fields, custom validation, or AJAX submission as your requirements evolve! 🎉
Happy Coding! 🚀