public AddRepairViewModel GetAllRepairDetailsForAdd() { AddRepairViewModel addRepairViewModel = new AddRepairViewModel(); var allCustomers = this.Context.Customers.ToList(); var allEmployees = this.Context.Employees.ToList(); var allItems = this.Context.Items.ToList(); foreach (Customer customer in allCustomers) { CustomerRepairViewModel customerRepairViewModel = Mapper.Map <CustomerRepairViewModel>(customer); addRepairViewModel.Customers.Add(customerRepairViewModel); } foreach (Employee employee in allEmployees) { EmployeeRepairViewModel employeeRepairView = Mapper.Map <EmployeeRepairViewModel>(employee); addRepairViewModel.Employees.Add(employeeRepairView); } foreach (Item item in allItems) { ItemRepairViewModel itemRepairViewModel = Mapper.Map <ItemRepairViewModel>(item); addRepairViewModel.Items.Add(itemRepairViewModel); } return(addRepairViewModel); }
private void OnSelectedMenuItem() { if (SelectedMenuItem == MenuResources.Repairs) { if (CustomerRepairViewModel == null) CustomerRepairViewModel = new CustomerRepairViewModel(this.Messenger, this.UserLogin, this.SelectedCustomer){ParentViewModel = this}; DetailSectionViewModel = CustomerRepairViewModel; return; } if (SelectedMenuItem == MenuResources.Detail) { SetSummaryView(); return; } if (SelectedMenuItem == MenuResources.Appointments) { DetailSectionViewModel = null; if (CustomerAppointmentViewModel == null) CustomerAppointmentViewModel = new CustomerAppointmentViewModel(this.Messenger, this.UserLogin, this.SelectedCustomer) { ParentViewModel = this }; DetailSectionViewModel = CustomerAppointmentViewModel; return; } if (SelectedMenuItem == MenuResources.Orders) { DetailSectionViewModel = null; if (CustomerOrderViewModel == null) CustomerOrderViewModel = new CustomerOrderViewModel(this.Messenger, this.UserLogin, this.SelectedCustomer) { ParentViewModel = this }; DetailSectionViewModel = CustomerOrderViewModel; return; } if (SelectedMenuItem == MenuResources.WarrantyInformed) { DetailSectionViewModel = null; if (CustomerWarrantyInformedViewModel == null) CustomerWarrantyInformedViewModel = new CustomerWarrantyInformedViewModel(this.Messenger, this.UserLogin, this.SelectedCustomer) { ParentViewModel = this }; DetailSectionViewModel = CustomerWarrantyInformedViewModel; } }