コード例 #1
0
        public ViewResult GetView()
        {
            EmployeeModel empobj = new EmployeeModel();

            empobj.EmpId     = 1;
            empobj.EmpName   = "Anna";
            empobj.EmpSalary = 27000;

            DepartmentModel deptobj = new DepartmentModel();

            deptobj.DeptId   = 1211;
            deptobj.DeptName = "Develpoment";

            EmpDeptDetail empdepobj = new EmpDeptDetail();

            empdepobj.emp = empobj;
            empdepobj.dep = deptobj;

            return(View("CustomizeModel", empdepobj));
        }
コード例 #2
0
        public ActionResult CustomizeModelExample2()
        {
            List <EmployeeModel> listobj = new List <EmployeeModel>();

            EmployeeModel obj = new EmployeeModel();

            obj.EmpId     = 1;
            obj.EmpName   = "Suraj";
            obj.EmpSalary = 27000;


            EmployeeModel obj1 = new EmployeeModel();

            obj1.EmpId     = 2;
            obj1.EmpName   = "Abhisek";
            obj1.EmpSalary = 5699;

            EmployeeModel obj2 = new EmployeeModel();

            obj2.EmpId     = 3;
            obj2.EmpName   = "Rambabu";
            obj2.EmpSalary = 6540;

            listobj.Add(obj);
            listobj.Add(obj1);
            listobj.Add(obj2);

            DepartmentModel deptobj = new DepartmentModel();

            deptobj.DeptId   = 1211;
            deptobj.DeptName = "Develpoment";

            EmpDeptDetail empdepobj = new EmpDeptDetail();

            empdepobj.listemp = listobj;
            empdepobj.dep     = deptobj;


            return(View(empdepobj));
        }