public ActionResult UpdateCustomerDetails(ExtendedCustomer extendedCustomer) { var status = customerAccountService.UpdateCustomer(extendedCustomer); if (status == MembershipCreateStatus.Success) { return(RedirectToAction("Index", "MyAccount")); } ; return(RedirectToAction("ReportError", "Services", new ReportErrorViewModel { ErrorMessage = "Can't update user details" })); }
public void SpecificationInheritance_OnObject_WithSpecification_IsValid() { //Base Class ValidationCatalog.SpecificationContainer.Add(new CustomerRequiredNameSpecification()); //Inherited class ValidationCatalog.AddSpecification<ExtendedCustomer>(spec => { spec.Using<Customer, CustomerRequiredNameSpecification>(); spec.Check(c => c.SpecialGreeting).Required(); }); var customer = new ExtendedCustomer(); var results = ValidationCatalog.Validate(customer); Assert.That(results.Errors.Count, Is.EqualTo(2)); var errorMessages = results.Errors.Select(x => x.ToString()); Assert.That(errorMessages.Contains("Name is required.")); Assert.That(errorMessages.Contains("Special Greeting is required.")); }
// Example of how the model can be extended static void extendingClass() { using (var databaseAccess = new DatabaseAccessService(new CarRentalContext())) { ModelCustomizer.RegisterModelCustomization( test => { test.Entity <ExtendedCustomer>(); }); var customer = new BasicCustomer { name = "Christie", dateOfBirth = new DateTime(1990, 1, 1) }; var extendedCustomer = new ExtendedCustomer { name = "Medda", dateOfBirth = new DateTime(1990, 1, 1), someNewValue = "hej" }; databaseAccess.addCustomer(customer).Wait(); databaseAccess.addCustomer(extendedCustomer).Wait(); } }
public void SpecificationInheritance_OnObject_WithSpecification_IsValid() { //Base Class ValidationCatalog.SpecificationContainer.Add(new CustomerRequiredNameSpecification()); //Inherited class ValidationCatalog.AddSpecification <ExtendedCustomer>(spec => { spec.Using <Customer, CustomerRequiredNameSpecification>(); spec.Check(c => c.SpecialGreeting).Required(); }); var customer = new ExtendedCustomer(); var results = ValidationCatalog.Validate(customer); Assert.That(results.Errors.Count, Is.EqualTo(2)); var errorMessages = results.Errors.Select(x => x.ToString()); Assert.That(errorMessages.Contains("Cust Name is required.")); Assert.That(errorMessages.Contains("Special Greeting is required.")); }
public MembershipCreateStatus CreateExtendedCustomer(ExtendedCustomer customer, string password) { throw new NotImplementedException(); }
public MembershipCreateStatus UpdateCustomer(ExtendedCustomer customer) { throw new NotImplementedException(); }
private ICustomerAccountService CreateCustomerAccountServiceWithExtendedCustomer(ExtendedCustomer extendedCustomer) { var customerAccountService = MockRepository.GenerateStub <ICustomerAccountService>(); customerAccountService.Stub(x => x.GetExtendedCustomerByEmail(Arg <string> .Is.Anything)). Return(extendedCustomer); return(customerAccountService); }