Esempio n. 1
0
 public RegisterCustomerCommand(
     int?gender,
     string firstname,
     string lastname,
     DateTime?birthdate,
     string comment
     )
 {
     Gender    = gender.HasValue ? (Gender)gender : Gender.Unset;
     Firstname = Name.From(firstname);
     Lastname  = Name.From(lastname);
     Birthdate = Birthdate.From(birthdate);
     Comment   = comment;
 }
Esempio n. 2
0
        public async Task <Customer> GetByIdAsync(CustomerId customerId)
        {
            CustomerEntity entity = await GetEntityById(customerId);

            if (entity is null)
            {
                return(null);
            }

            return(Customer.Rehydrate
                   (
                       CustomerId.From(entity.Id),
                       entity.Gender,
                       Name.From(entity.Firstname),
                       Name.From(entity.Lastname),
                       Birthdate.From(entity.Birthdate),
                       entity.Comment
                   ));
        }