Exemplo n.º 1
0
        //adding branch name in dropdown for studentBranch
        public ActionResult Ex4()
        {
            //adding mock data
            List <branch> branchList = new List <branch>();

            branchList.Add(new branch {
                branchId = 1, branchName = "Computer Science"
            });
            branchList.Add(new branch {
                branchId = 2, branchName = "IT"
            });
            branchList.Add(new branch {
                branchId = 3, branchName = "Electonics"
            });
            branchList.Add(new branch {
                branchId = 4, branchName = "Civil"
            });
            List <student> studList = new List <student>();

            studList.Add(new student {
                studentId = 070915, studentname = "Pratik Kumar", studentBranch = "Computer Science"
            });
            studList.Add(new student {
                studentId = 070915, studentname = "Ämrit Kumar", studentBranch = "Civil"
            });
            studentEditViewModel sm1 = new studentEditViewModel();

            sm1.student = new student {
                studentId = 070915, studentname = "Pratik Kumar", studentBranch = "Computer Science"
            };
            sm1.BranchList = new SelectList(branchList, "branchId", "branchName");
            return(View(sm1));
        }
Exemplo n.º 2
0
        public ActionResult Ex3()
        {
            //adding mock data
            List <branch> branchList = new List <branch>();

            branchList.Add(new branch {
                branchId = 1, branchName = "Computer Science"
            });
            branchList.Add(new branch {
                branchId = 2, branchName = "IT"
            });
            branchList.Add(new branch {
                branchId = 3, branchName = "Electonics"
            });
            branchList.Add(new branch {
                branchId = 4, branchName = "Civil"
            });
            studentEditViewModel sm = new studentEditViewModel();

            sm.BranchList = new SelectList(branchList, "branchId", "branchName");
            return(View(sm));
        }