public void SaveCustomer(CustomerDto customerDto) { SIRepository repository = new SIRepository(); repository.GetObject((x) => { return new Customer(); }); SIAccountServices accountServices = new SIAccountServices(); IDtoCreator<Customer, CustomerDto> custCreator = new CustomerDtoCreator(); SICustomerRepository customerRepository = new SICustomerRepository(); CustomerServices services = new CustomerServices(customerRepository, repository, accountServices, custCreator); services.SaveCustomer(customerDto); }
public void Update(ref Customer customer, CustomerDto customerDto) { customer.Email = customerDto.Email; customer.FirstName = customerDto.FirstName; customer.LastName = customerDto.LastName; customer.PhoneNumber = customerDto.PhoneNumber; customer.Situation = customerDto.Situation; }
public void SaveCustomer(CustomerDto customer) { Contract.Requires<CustomerServicesException>(customer != null); Contract.Requires<CustomerServicesException>(customer.Email != null); }
public void SaveCustomer(CustomerDto customerDto) { Customer customer = _repository.Load<Customer>(customerDto.Id); if (customer == null) { throw new CustomerServicesException(String.Format("Could not find customer in the DB: {0}", customerDto.Id)); } Update(ref customer, customerDto); using (TransactionScope scope = new TransactionScope()) { _repository.Update<Customer>(customer); _repository.Flush(); scope.Complete(); } }
public void SaveCustomerDto(CustomerDto customerDto) { CustomerServices.SaveCustomer(customerDto); }