Beispiel #1
0
        internal Address AddAddress(NewAddressDto addressDto)
        {
            Address address = new Address(addressDto);

            _addresses.Add(address);
            return(address);
        }
        public async Task <Address> GetAsync(NewAddressDto addressDto, Guid?id, Guid userId)
        {
            if (id != null)
            {
                var user = await userRepository.GetAndEnsureExistAsync(userId);

                return(user.Orders
                       .Select(s => s.Address)
                       .Distinct()
                       .EnsureSingleExists(s => s.Id == id.Value));
            }

            return(new Address(addressDto.Street, addressDto.City, addressDto.Country, addressDto.PostCode, addressDto.PhoneNumber));
        }
Beispiel #3
0
 public Address(NewAddressDto addressDto)
     : this(addressDto.Name,
            addressDto.Path,
            addressDto.IsSingleUrl)
 {
 }