public static CustomerViewModel Create(CustomerDomain customerDomain)
 {
     return new CustomerViewModel
     {
         Id = customerDomain.Id,
         Name = customerDomain.Name,
         Email = customerDomain.Email,
         Phone = customerDomain.Phone,
         PIN = customerDomain.PIN
     };
 }
 public static Customer Create(CustomerDomain customerDomain)
 {
     return new Customer
     {
         Id = customerDomain.Id,
         Name = customerDomain.Name,
         Email = customerDomain.Email,
         Phone = customerDomain.Phone,
         PIN = customerDomain.PIN
         //Products = customerDomain.Products.GetAll().Select(ProductFactory.Create);
     };
 }
Пример #3
0
 public static ProductDomain Create(Product product, CustomerDomain customerDomain)
 {
     ProductDomain productDomain = new ProductDomain
     {
     Id = product.Id,
     Name = product.Name,
     ReleaseDate = product.ReleaseDate,
     Type = product.Type,
     CustomerId = product.CustomerId
     };
     if (customerDomain != null)
     {
     productDomain.Customer = customerDomain;
     }
     else
     {
     productDomain.Customer = product.Customer == null ? null : product.Customer.CreateCustomerDomain();
     }
     return productDomain;
 }
Пример #4
0
        public static CustomerDomain Create(Customer customer)
        {
            CustomerDomain customerDomain = new CustomerDomain
            {
                Id = customer.Id,
                Name = customer.Name,
                Email = customer.Email,
                Phone = customer.Phone,
                PIN = customer.PIN
            };

            if (customer.Products != null && customer.Products.Any())
            {
                var productList = new List<ProductDomain>();
                foreach (var product in customer.Products)
                {
                    productList.Add(product.CreateProductDomain(customerDomain));
                }
                customerDomain.Products = productList;
            }
            return customerDomain;
        }
Пример #5
0
 private static void Display(CustomerDomain customerDomain)
 {
     Console.Write("Product name: {0}", customerDomain.Name);
 }
Пример #6
0
 public static CustomerViewModel Create(CustomerDomain customerDomain)
 {
     return new CustomerViewModel { Id = customerDomain.Id, Name = customerDomain.Name };
 }
Пример #7
0
 public static ProductDomain CreateProductDomain(this Product product, CustomerDomain customerDomain = null)
 {
     return Create(product, customerDomain);
 }