Example #1
0
        static void Main(string[] args)
        {
            //从数据库获取学生记录
            Student model = retrieveStudentFromDatabase();

            //创建一个视图:把学生详细信息输出到控制台
            StudentView view = new StudentView();

            // 其实就是将视图和实体交给Controller处理
            StudentController controller = new StudentController(model, view);

            controller.updateView();

            //更新模型数据
            controller.setStudentName("John");

            controller.updateView();

            Console.ReadLine();
        }
Example #2
0
 public StudentController(Student model, StudentView view)
 {
     this.model = model;
     this.view  = view;
 }