Skip to content

Commit 5ce63b1

Browse files
committed
update UI for delete page
1 parent 09c9c1e commit 5ce63b1

File tree

2 files changed

+46
-34
lines changed

2 files changed

+46
-34
lines changed

src/WorkforceAnalyticsDashboard/WorkforceAnalyticsDashboard/Controllers/EmployeeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ public async Task<IActionResult> Delete(int? id)
184184
}
185185

186186
var employee = await _context.Employees
187+
.Include(e => e.Department)
188+
.Include(e => e.Job)
187189
.FirstOrDefaultAsync(m => m.EmployeeID == id);
190+
188191
if (employee == null)
189192
{
190193
return NotFound();
Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,84 @@
1-
@model Employee
1+
@model WorkforceAnalyticsDashboard.Models.Employee
22

33
@{
44
ViewData["Title"] = "Delete";
55
}
66

77
<h1>Delete</h1>
88

9-
<h3>Are you sure you want to delete this?</h3>
9+
<h3 class="mb-4">Are you sure you want to delete this?</h3>
10+
1011
<div>
1112
<h4>Employee</h4>
1213
<hr />
1314
<dl class="row">
14-
<dt class = "col-sm-2">
15-
@Html.DisplayNameFor(model => model.FirstName)
15+
<dt class="col-sm-2">
16+
First Name
1617
</dt>
17-
<dd class = "col-sm-10">
18+
<dd class="col-sm-10">
1819
@Html.DisplayFor(model => model.FirstName)
1920
</dd>
20-
<dt class = "col-sm-2">
21-
@Html.DisplayNameFor(model => model.LastName)
21+
22+
<dt class="col-sm-2">
23+
Last Name
2224
</dt>
23-
<dd class = "col-sm-10">
25+
<dd class="col-sm-10">
2426
@Html.DisplayFor(model => model.LastName)
2527
</dd>
26-
<dt class = "col-sm-2">
27-
@Html.DisplayNameFor(model => model.Email)
28+
29+
<dt class="col-sm-2">
30+
Email
2831
</dt>
29-
<dd class = "col-sm-10">
32+
<dd class="col-sm-10">
3033
@Html.DisplayFor(model => model.Email)
3134
</dd>
32-
<dt class = "col-sm-2">
33-
@Html.DisplayNameFor(model => model.PhoneNumber)
35+
36+
<dt class="col-sm-2">
37+
Phone Number
3438
</dt>
35-
<dd class = "col-sm-10">
39+
<dd class="col-sm-10">
3640
@Html.DisplayFor(model => model.PhoneNumber)
3741
</dd>
38-
<dt class = "col-sm-2">
39-
@Html.DisplayNameFor(model => model.HireDate)
42+
43+
<dt class="col-sm-2">
44+
Hire Date
4045
</dt>
41-
<dd class = "col-sm-10">
46+
<dd class="col-sm-10">
4247
@Html.DisplayFor(model => model.HireDate)
4348
</dd>
44-
<dt class = "col-sm-2">
45-
@Html.DisplayNameFor(model => model.DepartmentID)
49+
50+
<dt class="col-sm-2">
51+
Department
4652
</dt>
47-
<dd class = "col-sm-10">
48-
@Html.DisplayFor(model => model.DepartmentID)
53+
<dd class="col-sm-10">
54+
@Model.Department?.Name
4955
</dd>
50-
<dt class = "col-sm-2">
51-
@Html.DisplayNameFor(model => model.JobID)
56+
57+
<dt class="col-sm-2">
58+
Job
5259
</dt>
53-
<dd class = "col-sm-10">
54-
@Html.DisplayFor(model => model.JobID)
60+
<dd class="col-sm-10">
61+
@Model.Job?.JobTitle
5562
</dd>
56-
<dt class = "col-sm-2">
57-
@Html.DisplayNameFor(model => model.Salary)
63+
64+
<dt class="col-sm-2">
65+
Salary
5866
</dt>
59-
<dd class = "col-sm-10">
67+
<dd class="col-sm-10">
6068
@Html.DisplayFor(model => model.Salary)
6169
</dd>
62-
<dt class = "col-sm-2">
63-
@Html.DisplayNameFor(model => model.Status)
70+
71+
<dt class="col-sm-2">
72+
Status
6473
</dt>
65-
<dd class = "col-sm-10">
74+
<dd class="col-sm-10">
6675
@Html.DisplayFor(model => model.Status)
6776
</dd>
6877
</dl>
69-
78+
7079
<form asp-action="Delete">
7180
<input type="hidden" asp-for="EmployeeID" />
72-
<input type="submit" value="Delete" class="btn btn-danger" /> |
73-
<a asp-action="Index">Back to List</a>
81+
<input type="submit" value="Delete" class="btn btn-danger" />
82+
<a asp-action="Index" class="btn btn-outline-secondary">Back to List</a>
7483
</form>
7584
</div>

0 commit comments

Comments
 (0)