-
+
Web.config
diff --git a/FirstMVCDemo/Models/Address.cs b/FirstMVCDemo/Models/Address.cs
new file mode 100644
index 0000000..286d4bc
--- /dev/null
+++ b/FirstMVCDemo/Models/Address.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace FirstMVCDemo.Models
+{
+ public class Address
+ {
+ public int AddressId { get; set; }
+ public string Country { get; set; }
+ public string State { get; set; }
+ public string City { get; set; }
+ public string Pin { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/FirstMVCDemo/Models/Employee.cs b/FirstMVCDemo/Models/Employee.cs
index 776663a..53cca9d 100644
--- a/FirstMVCDemo/Models/Employee.cs
+++ b/FirstMVCDemo/Models/Employee.cs
@@ -9,9 +9,9 @@ namespace FirstMVCDemo.Models
{
public int EmployeeId { get; set; }
public string Name { get; set; }
- public string Address { get; set; }
- public string City { get; set; }
public string Gender { get; set; }
+ public string Department { get; set; }
public decimal Salary { get; set; }
+ public int AddressId { get; set; }
}
}
\ No newline at end of file
diff --git a/FirstMVCDemo/Models/EmployeeBusinessLayer.cs b/FirstMVCDemo/Models/EmployeeBusinessLayer.cs
deleted file mode 100644
index 27ab66d..0000000
--- a/FirstMVCDemo/Models/EmployeeBusinessLayer.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-
-namespace FirstMVCDemo.Models
-{
- public class EmployeeBusinessLayer
- {
- public Employee GetEmployeeDetails(int EmployeeId)
- {
- //Here we hardcoded the data
- //later we will discuss how to retrieve
- //the data from a database
- Employee employee = new Employee()
- {
- EmployeeId = EmployeeId,
- Name = "Pranaya",
- Gender = "Male",
- City = "Mumbai",
- Salary = 1000,
- Address = "Andheri"
- };
- return employee;
- }
- }
-}
\ No newline at end of file
diff --git a/FirstMVCDemo/ViewModels/EmployeeDetailsViewModel.cs b/FirstMVCDemo/ViewModels/EmployeeDetailsViewModel.cs
new file mode 100644
index 0000000..99052a3
--- /dev/null
+++ b/FirstMVCDemo/ViewModels/EmployeeDetailsViewModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+using FirstMVCDemo.Models;
+
+namespace FirstMVCDemo.ViewModels
+{
+ public class EmployeeDetailsViewModel
+ {
+ public Employee Employee { get; set; }
+ public Address Address { get; set; }
+ public string PageTitle { get; set; }
+ public string PageHeader { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/FirstMVCDemo/Views/Employee/Details.cshtml b/FirstMVCDemo/Views/Employee/Details.cshtml
new file mode 100644
index 0000000..210b686
--- /dev/null
+++ b/FirstMVCDemo/Views/Employee/Details.cshtml
@@ -0,0 +1,45 @@
+@model FirstMVCDemo.ViewModels.EmployeeDetailsViewModel
+
+@{
+ Layout = null;
+}
+
+
+
+
+
+
+ @Model.PageTitle
+
+
+ @Model.PageHeader
+
+ EmployeeID: @Model.Employee.EmployeeId
+
+
+ Name : @Model.Employee.Name
+
+
+ Gender : @Model.Employee.Gender
+
+
+ Department : @Model.Employee.Department
+
+
+ Salary : @Model.Employee.Salary
+
+ Employee Address
+
+ City : @Model.Address.City
+
+
+ State : @Model.Address.State
+
+
+ Country : @Model.Address.Country
+
+
+ Pin : @Model.Address.Pin
+
+
+
diff --git a/FirstMVCDemo/Views/Home/Index.cshtml b/FirstMVCDemo/Views/Home/Index.cshtml
deleted file mode 100644
index d9d0d8a..0000000
--- a/FirstMVCDemo/Views/Home/Index.cshtml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-@{
- Layout = null;
-}
-@model FirstMVCDemo.Models.Employee
-
-
-
-
-
- Page Title
-
-
-
- @ViewBag.Header
-
-
- Employee ID: |
- @Model.EmployeeId |
-
-
- Name: |
- @Model.Name |
-
-
- Gender: |
- @Model.Gender |
-
-
- City: |
- @Model.City |
-
-
- Salary: |
- @Model.Salary |
-
-
- Address: |
- @Model.Address |
-
-
-
-