Example #1
0
        static void Main(string[] args)
        {
            Student modal = RetriveStudentFromDatabase();

            StudentView view = new StudentView();

            StudentController controller = new StudentController(modal, view);

            controller.UpdateView();

            controller.SetStudentName("Jhon");

            controller.UpdateView();
        }
Example #2
0
        /// <summary>
        ///  https://www.tutorialspoint.com/design_pattern/mvc_pattern.htm
        /// </summary>
        /// <param name="args"></param>
        ///
        static void Main(string[] args)
        {
            //fetch student record based on his roll no from the database
            Student model = RetrieveStudentFromDatabase();

            //Create a view : to write student details on console
            StudentView view = new StudentView();

            StudentController controller = new StudentController(model, view);

            controller.UpdateView();

            //update model data
            controller.SetStudentName("John");

            controller.UpdateView();
        }
Example #3
0
        public static void Demo()
        {
            //fetch student record based on his roll no from the database
            Student s = new Student()
            {
                Name = "A", ID = 1
            };

            //Create a view : to write student details on console
            StudentView v = new StudentView();

            StudentController sc = new StudentController(s, v);

            sc.UpdateView();

            //update model
            sc.SetName("B");
            sc.UpdateView();
            Console.Read();
        }
Example #4
0
 public StudentController(Student modal, StudentView view)
 {
     _studentModal     = modal;
     _studentViewModal = view;
 }
Example #5
0
 public StudentController(Student model, StudentView view)
 {
     this.model = model;
     this.view  = view;
 }