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();
|
EmployeeBusinessLayer employeeBL = new EmployeeBusinessLayer();
|
||||||
Employee employee = employeeBL.GetEmployeeDetails(101);
|
Employee employee = employeeBL.GetEmployeeDetails(101);
|
||||||
|
|
||||||
ViewBag.Employee = employee;
|
|
||||||
ViewBag.Header = "Employee Details";
|
ViewBag.Header = "Employee Details";
|
||||||
|
|
||||||
return View();
|
return View(employee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
@{
|
@{
|
||||||
Layout = null;
|
Layout = null;
|
||||||
}
|
}
|
||||||
|
@model FirstMVCDemo.Models.Employee
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
@ -11,35 +11,32 @@
|
|||||||
<title>Page Title</title>
|
<title>Page Title</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@{
|
|
||||||
var employee = ViewBag.Employee;
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewBag.Header</h2>
|
<h2>@ViewBag.Header</h2>
|
||||||
<table style="font-family:Arial">
|
<table style="font-family:Arial">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Employee ID:</td>
|
<td>Employee ID:</td>
|
||||||
<td>@employee.EmployeeId</td>
|
<td>@Model.EmployeeId</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Name:</td>
|
<td>Name:</td>
|
||||||
<td>@employee.Name</td>
|
<td>@Model.Name</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Gender:</td>
|
<td>Gender:</td>
|
||||||
<td>@employee.Gender</td>
|
<td>@Model.Gender</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>City:</td>
|
<td>City:</td>
|
||||||
<td>@employee.City</td>
|
<td>@Model.City</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Salary:</td>
|
<td>Salary:</td>
|
||||||
<td>@employee.Salary</td>
|
<td>@Model.Salary</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Address:</td>
|
<td>Address:</td>
|
||||||
<td>@employee.Address</td>
|
<td>@Model.Address</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user