public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request) { DeliveryAddressAddResponse response = new DeliveryAddressAddResponse(); Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken); Address address = ConvertToAddress(request.Address); customer.AddAddress(address, request.Address.Name); _customerRepository.Save(customer); _uow.Commit(); //response.DeliveryAddress = deliveryAddress.ConvertToDeliveryAddressView(); return(response); }
public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request) { DeliveryAddressAddResponse response = new DeliveryAddressAddResponse(); Customer customer = _customerRepository.FindBy(request.CustomerEmail); DeliveryAddress deliveryAddress = new DeliveryAddress(); deliveryAddress.Customer = customer; UpdateDeliveryAddressFrom(request.Address, deliveryAddress); customer.AddAddress(deliveryAddress); _customerRepository.Save(customer); _uow.Commit(); response.DeliveryAddress = _mapper.Map <DeliveryAddress, DeliveryAddressView>(deliveryAddress); return(response); }
public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request) { DeliveryAddressAddResponse response = new DeliveryAddressAddResponse(); Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken); DeliveryAddress deliveryAddress = new DeliveryAddress(); deliveryAddress.Customer = customer; UpdateDeliveryAddressFrom(request.Address, deliveryAddress); customer.AddAddress(deliveryAddress); _customerRepository.Save(customer); _uow.Commit(); response.DeliveryAddress = deliveryAddress.ConvertToDeliveryAddressView(); return(response); }