public CustomerContextFacade() { CurrentContact = new CurrentContactFacade(); }
public CustomerContextFacade(MapUserKey mapUserKey) { CurrentContact = new CurrentContactFacade(); _mapUserKey = mapUserKey; }
public HeaderController(CurrentContactFacade currentContactFacade, IContentLoader contentLoader) { _contentLoader = contentLoader; _currentContactFacade = currentContactFacade; }
private CustomerAddress GetAddress(CurrentContactFacade contact, string addressId) { return contact.ContactAddresses.FirstOrDefault(x => x.Name == addressId); }
private CustomerAddress CreateOrUpdateCustomerAddress(CurrentContactFacade contact, AddressModel addressModel) { var customerAddress = GetAddress(contact, addressModel.AddressId); var isNew = customerAddress == null; IEnumerable<PrimaryKeyId> existingId = contact.ContactAddresses.Select(a => a.AddressId).ToList(); if (isNew) { customerAddress = CustomerAddress.CreateInstance(); } MapToAddress(addressModel, customerAddress); if (isNew) { contact.AddContactAddress(customerAddress); } else { contact.UpdateContactAddress(customerAddress); } contact.SaveChanges(); if (isNew) { customerAddress.AddressId = contact.ContactAddresses .Where(a => !existingId.Contains(a.AddressId)) .Select(a => a.AddressId) .Single(); addressModel.AddressId = customerAddress.Name; } return customerAddress; }
private CustomerAddress GetAddress(CurrentContactFacade contact, Guid? addressId) { return addressId.HasValue ? contact.ContactAddresses.FirstOrDefault(x => x.AddressId == addressId.GetValueOrDefault()) : null; }
public FakeCustomerContext(CurrentContactFacade currentContact) { _currentContact = currentContact; }