public Address AddOrUpdateAddress(Address existingAddress, AddressModel newOrUpdatedAddress)
        {
            if (existingAddress is null)
            {
                return(newOrUpdatedAddress.ToDomain());
            }

            context.Entry(existingAddress).CurrentValues.SetValues(newOrUpdatedAddress);
            return(existingAddress);
        }
Ejemplo n.º 2
0
        public Address AddOrUpdateAddress(Address existingAddress, AddressModel newOrUpdatedAddress)
        {
            if (existingAddress is null)
            {
                return(newOrUpdatedAddress.ToDomain());
            }

            if (newOrUpdatedAddress is null)
            {
                return(existingAddress);
            }

            existingAddress.Line1    = newOrUpdatedAddress.Line1;
            existingAddress.Line2    = newOrUpdatedAddress.Line2;
            existingAddress.Line3    = newOrUpdatedAddress.Line3;
            existingAddress.Line4    = newOrUpdatedAddress.Line4;
            existingAddress.Line5    = newOrUpdatedAddress.Line5;
            existingAddress.Town     = newOrUpdatedAddress.Town;
            existingAddress.County   = newOrUpdatedAddress.County;
            existingAddress.Postcode = newOrUpdatedAddress.Postcode;
            existingAddress.Country  = newOrUpdatedAddress.Country;

            return(existingAddress);
        }
Ejemplo n.º 3
0
        public static void ToDomain_Address_ReturnsExpectedAddress(AddressModel model)
        {
            var actual = model.ToDomain();

            actual.Should().BeEquivalentTo(model);
        }