public void Execute() { List <Student> students = _repository.GetAll(); List <StudentResponse> response = students.Select(x => StudentAdapter.GetResponse(x)).ToList(); _presenter.Notify(response); }
static void Main(string[] args) { Dictionary <string, string> result = null; List <string> studentList = null; /*Old code*/ StudentManager studentManager = new StudentManager(); result = studentManager.GetAllSelectedSujects(); Console.WriteLine("Old code without using Adapter class"); DisplayResult(result); studentList = studentManager.GetStudentList(); Console.WriteLine(); Console.WriteLine("GetStudentList() Method in StudentManager Class accessing using StudentManager class"); DisplayStudents(studentList); Console.WriteLine(); /*New code*/ StudentAdapter student = new StudentAdapter(); result = student.GetAllSelectedSujects(); Console.WriteLine("New code with using Adapter class"); DisplayResult(result); studentList = student.GetStudentList(); Console.WriteLine(); Console.WriteLine("GetStudentList() Method in StudentManager Class accessing using Adapter class"); DisplayStudents(studentList); Console.ReadLine(); }
private static void GetStudent() { var repository = new StudentRepository(); var adapter = new StudentAdapter(repository); var interactor = new StudentGetInteractor(adapter); var student = interactor.GetStudent(); Console.WriteLine("Anumber: " + student.Anumber); Console.WriteLine("First Name: " + student.FirstName); Console.WriteLine("Last Name: " + student.LastName); }
private void connectActions() { addStudentButton.Click += AddStudentButton_Click; //set up addapter for list view stAdapter = new StudentAdapter(this); studentListView.Adapter = stAdapter; studentListView.FastScrollEnabled = true; studentListView.ItemClick += StudentListView_ItemClick; studentListView.ItemLongClick += StudentListView_ItemLongClick; }
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 void Execute(Guid id) { try { Student entity = _repository.GetByID(id); StudentResponse response = StudentAdapter.GetResponse(entity); _presenter.Notify(response); } catch (Exception exc) { throw new StudentException("Error while get student!", exc); } }
public void Execute(StudentRequest student) { try { Student entity = StudentAdapter.GetEntity(student); entity.ListCources = student.ListCourses.Select(x => _courseRepository.GetByID(x)).ToList(); _studentRepository.Update(entity); } catch (Exception exc) { throw new StudentException("Error while update student!", exc); } }
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()); }
private static void CreateStudent() { var repository = new StudentRepository(); var adapter = new StudentAdapter(repository); var interactor = new StudentCreateInteractor(adapter); //student would be received from FormBody var studentFromFormBody = new Student { Anumber = "A9033829465", FirstName = "Jordanzo", LastName = "Hollywood" }; interactor.CreateStudent(studentFromFormBody); }
public static async Task <IEnumerable <Student> > GetStudentsDetailsByFamily(SchoolContext context, int fid, int schoolYear) { var d = from s in context.Students join r in context.Registrations on new { Id = s.Id, Year = schoolYear } equals new { Id = r.StudentId, Year = r.SchoolYear } into sg from r in sg.DefaultIfEmpty() where s.FamilyId == fid select new { Student = s, Registration = r }; var sr = await d.ToListAsync(); if (sr == null || sr.Count == 0) { return(null); } return(sr.Select(x => StudentAdapter.GetStudent(x.Student, x.Registration)).ToList()); }
public void TestMethod1() { IStudentList adapter = new StudentAdapter(); StudentData firstStudent = new StudentData(); firstStudent.Id = 1; firstStudent.FirstName = "Tom"; firstStudent.LastName = "Plank"; firstStudent.StudentCode = "006116"; firstStudent.ProgrammeCode = "IABB"; firstStudent.ProgrammeName = "Business Information Technology"; firstStudent.Faculty = "Information Technologies"; adapter.AddStudent(firstStudent); Assert.AreEqual(adapter.GetStudents().First().ID, 1); Assert.AreEqual(adapter.GetStudents().First().Name, "Tom Plank"); Assert.AreEqual(adapter.GetStudents().First().StudentIdentifier, "006116IABB"); Assert.AreEqual(adapter.GetStudents().First().Programme, "Business Information Technology"); Assert.AreEqual(adapter.GetStudents().First().Faculty, "Information Technologies"); }
public StudentListFragment(StudentFilter studentFilter) { this.studentFilter = studentFilter; this.studentAdapter = new StudentAdapter(); }