Finished 'Strongly Typed View in ASP.NET MVC'
This commit is contained in:
parent
a875b59057
commit
74036dd9de
@ -16,10 +16,9 @@ namespace FirstMVCDemo.Controllers
|
||||
EmployeeBusinessLayer employeeBL = new EmployeeBusinessLayer();
|
||||
Employee employee = employeeBL.GetEmployeeDetails(101);
|
||||
|
||||
ViewBag.Employee = employee;
|
||||
ViewBag.Header = "Employee Details";
|
||||
|
||||
return View();
|
||||
return View(employee);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@model FirstMVCDemo.Models.Employee
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
@ -11,35 +11,32 @@
|
||||
<title>Page Title</title>
|
||||
</head>
|
||||
<body>
|
||||
@{
|
||||
var employee = ViewBag.Employee;
|
||||
}
|
||||
|
||||
<h2>@ViewBag.Header</h2>
|
||||
<table style="font-family:Arial">
|
||||
<tr>
|
||||
<td>Employee ID:</td>
|
||||
<td>@employee.EmployeeId</td>
|
||||
<td>@Model.EmployeeId</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name:</td>
|
||||
<td>@employee.Name</td>
|
||||
<td>@Model.Name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gender:</td>
|
||||
<td>@employee.Gender</td>
|
||||
<td>@Model.Gender</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>City:</td>
|
||||
<td>@employee.City</td>
|
||||
<td>@Model.City</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Salary:</td>
|
||||
<td>@employee.Salary</td>
|
||||
<td>@Model.Salary</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Address:</td>
|
||||
<td>@employee.Address</td>
|
||||
<td>@Model.Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user