Esempio n. 1
0
        //// Should get list from database.
        //IList<Student> studentList = new List<Student>
        //{
        //    new Student() { StudentId = 1, StudentName = "John", Age = 18, Email = "*****@*****.**" } ,
        //    new Student() { StudentId = 2, StudentName = "Steve",  Age = 21, Email = "*****@*****.**" } ,
        //    new Student() { StudentId = 3, StudentName = "Bill",  Age = 25, Email = "*****@*****.**" } ,
        //    new Student() { StudentId = 4, StudentName = "Ram" , Age = 20, Email = "*****@*****.**" } ,
        //    new Student() { StudentId = 5, StudentName = "Ron" , Age = 31, Email = "*****@*****.**" } ,
        //    new Student() { StudentId = 6, StudentName = "Chris" , Age = 17, Email = "*****@*****.**" } ,
        //    new Student() { StudentId = 7, StudentName = "Rob" , Age = 19, Email = "*****@*****.**" }
        //};

        // GET: Student
        public ActionResult Index()
        {
            //ViewBag.TotalStudents = studentList.Count();

            // Get data from database.
            IList <Student> listOfStudents = StudentDao.GetFullList();

            ViewBag.TotalStudents = listOfStudents.Count();

            IList <Student> blackList = new List <Student>();

            blackList.Add(new Student()
            {
                StudentName = "Black One", Age = 20
            });
            blackList.Add(new Student()
            {
                StudentName = "Black Two", Age = 22
            });
            ViewData["blackList"] = blackList;

            //return View(studentList);
            return(View(listOfStudents));
        }