public ActionResult CreateCustomer() { var viewModel = new CreateCustomerViewModel(); IEnumerable<Customer> customers = GetCustomers(User.Identity.Name, new GetCustomersRequest()); customers.ToList().ForEach(x => viewModel.AddParentCustomer(new CustomerViewModel { Id = x.CustomerId, Name = x.Name, })); var users = _accountRepository.GetUsers(); users.ToList().ForEach(x => { if (x.Username != "admin") { viewModel.AddUser(x); } }); return View(viewModel); }
protected override void Context() { Username = "******"; base.Context(); _createCustomerInputModel = Builder<CreateCustomerInputModel>.CreateNew().Build(); _createCustomerInputModel.CustomerType = CustomerType.Undefined; CustomerService.Stub( x => x.CreateCustomer(Arg<string>.Is.Equal(Username), Arg<CreateCustomerRequest>.Is.Anything)) .Return( new CreateCustomerResponse(new List<string> {"some error from the domain", "another error from the domain"}) { Success = false, }); _expectedViewModel = new CreateCustomerViewModel(new List<string> {"some error from the domain", "another error from the domain"}) { Name = _createCustomerInputModel.Name, Street = _createCustomerInputModel.Street, AdditionalInfo = _createCustomerInputModel.AdditionalInfo, City = _createCustomerInputModel.City, State = _createCustomerInputModel.State, Zipcode = _createCustomerInputModel.Zipcode, ContactFirstName = _createCustomerInputModel.ContactFirstName, ContactLastName = _createCustomerInputModel.ContactLastName, ContactPhone = _createCustomerInputModel.ContactPhone, Phone = _createCustomerInputModel.Phone, CustomerType = _createCustomerInputModel.CustomerType, GooglePlacesUrl = _createCustomerInputModel.GooglePlacesUrl, ListName = _createCustomerInputModel.ListName, TwitterHandle = _createCustomerInputModel.TwitterHandle, WebsiteUrl = _createCustomerInputModel.WebsiteUrl, FacebookUrl = _createCustomerInputModel.FacebookUrl }; }