diff --git a/FirstMVCDemo/Controllers/HomeController.cs b/FirstMVCDemo/Controllers/HomeController.cs index 768459d..a0f58ae 100644 --- a/FirstMVCDemo/Controllers/HomeController.cs +++ b/FirstMVCDemo/Controllers/HomeController.cs @@ -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); } } } \ No newline at end of file diff --git a/FirstMVCDemo/Views/Home/Index.cshtml b/FirstMVCDemo/Views/Home/Index.cshtml index f8c421f..d9d0d8a 100644 --- a/FirstMVCDemo/Views/Home/Index.cshtml +++ b/FirstMVCDemo/Views/Home/Index.cshtml @@ -2,7 +2,7 @@ @{ Layout = null; } - +@model FirstMVCDemo.Models.Employee @@ -11,35 +11,32 @@
Employee ID: | -@employee.EmployeeId | +@Model.EmployeeId |
Name: | -@employee.Name | +@Model.Name |
Gender: | -@employee.Gender | +@Model.Gender |
City: | -@employee.City | +@Model.City |
Salary: | -@employee.Salary | +@Model.Salary |
Address: | -@employee.Address | +@Model.Address |