Example #1
0
 private Result MapCustomer(Maybe <CustomerEntity> customer, CustomerDetailsViewModel viewModel)
 {
     if (customer.HasNoValue)
     {
         return(Result.Fail(new Dictionary <string, object>()
         {
             { nameof(customer.Value), customer.Value }
         }));
     }
     viewModel.FullName     = PersonName.Create(customer).Value;
     viewModel.DateOfBirth  = CustomerDateOfBirth.Create(customer.Value.DateOfBirth, viewModel.Configuration?.Format).Value;
     viewModel.Address      = PostalAddress.Create(customer.Value.PostalAddress).Value;
     viewModel.MobileNumber = customer.Value.MobileNumber;
     viewModel.HomeNumber   = customer.Value.HomeNumber;
     viewModel.EmailAddress = customer.Value.EmailAddress;
     return(Result.Ok());
 }