public IActionResult viewCustomer(string searchID) { var customer = _customerService.getCustomerByUniqueID(searchID); if (customer != null) { var viewmodel = new CustomerOverviewViewModel() { CustomerId = customer.CustomerId, UniqueId = customer.UniqueId, Birthday = customer.Birthday, City = customer.City, Country = customer.Country, CountryCode = customer.CountryCode, Emailaddress = customer.Emailaddress, Gender = customer.Gender, Givenname = customer.Givenname, NationalId = customer.NationalId, Streetaddress = customer.Streetaddress, Surname = customer.Surname, Telephonecountrycode = customer.Telephonecountrycode, Telephonenumber = customer.Telephonenumber, Zipcode = customer.Zipcode }; viewmodel.TotalAmount = _customerService.getTotalAmountByID(customer.CustomerId); viewmodel.Accounts = _accountService.getAccountsByCustomerID(customer.CustomerId); return(View(viewmodel)); } else { return(View("CustomerNotFound")); } }
public IActionResult ChangeCustomer(CustomerOverviewViewModel model) { if (ModelState.IsValid) { var servicemodel = _mapper.Map <CustomerOverviewViewModel, ChangeCustomerServiceModel>(model); _customerService.ChangeCustomer(servicemodel); model.CustomerChanged = true; } else { model.CustomerChanged = false; } model.Accounts = _accountService.getAccountsByCustomerID(model.CustomerId); return(View("viewCustomer", model)); }
public ViewModelLocator() { _navigationService = new NavigationService(); _dataService = new DataService(new UserRepository(), new MenuRepository(), new DishRepository(), new CustomerRepository(), new DelivererRepository(), new EventRepository(), new IngredientRepository()); CustomerOverviewViewModel = new CustomerOverviewViewModel(_navigationService, _dataService); DelivererOverviewViewModel = new DelivererOverviewViewModel(_navigationService, _dataService); EventOverviewViewModel = new EventOverviewViewModel(_navigationService, _dataService); LoginViewModel = new LoginViewModel(_navigationService, _dataService); MainViewModel = new MainViewModel(_navigationService, _dataService); EditCustomerViewModel = new EditCustomerViewModel(_navigationService, _dataService); EditDelivererViewModel = new EditDelivererViewModel(_navigationService, _dataService); EditEventViewModel = new EditEventViewModel(_navigationService, _dataService); EditStaffViewModel = new EditStaffViewModel(_navigationService, _dataService); NewDelivererViewModel = new NewDelivererViewModel(_navigationService, _dataService); NewDishViewModel = new NewDishViewModel(_navigationService, _dataService); NewEventViewModel = new NewEventViewModel(_navigationService, _dataService); NewMenuViewModel = new NewMenuViewModel(_navigationService, _dataService); NewStaffViewModel = new NewStaffViewModel(_navigationService, _dataService); StaffViewModel = new StaffViewModel(_navigationService, _dataService); }