Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            _studentsReadService = new StudentsReadService();

            // It will display only the Id, because the UI expects each student to have properties "Name" and "Surname"
            // but in reality, the models returned by the BLL have "FirstName" and "LastName"
            listViewStudents.ItemsSource = _studentsReadService.GetAllStudents();
        }
        public MainWindow()
        {
            InitializeComponent();

            _studentsReadService = new StudentsReadService();

            // It will display only the Id, because the UI expects each student to have "FirstName" and "LastName" properties
            // but in reality, the models returned by the BLL have "Name" and "Surname"
            var adapter = new StudentAdapter();

            listViewStudents.ItemsSource = adapter.ConvertToViewModelList(_studentsReadService.GetAllStudents());
        }
        public MainWindow()
        {
            InitializeComponent();

            _studentsReadService = new StudentsReadService();

            // It will display only the Id, because the UI expects each student to have "FirstName" and "LastName" properties
            // but in reality, the models returned by the BLL have "Name" and "Surname"
            //listViewStudents.ItemsSource = _studentsReadService.GetAllStudents();

            // So, we need an adapter, to offer the expected "interface" for the class Student
            var adapter = new StudentAdapter();

            listViewStudents.ItemsSource = adapter.GetStudentViewModelList(_studentsReadService.GetAllStudents());
        }