private static Product GenerateProduct(Manufacturer manufacturer) { Product newProduct = new Product(); if (manufacturer != null) { newProduct.ManufacturerId = manufacturer.Id; } newProduct.Name = GenerateProductName(); newProduct.Description = GenerateDescription(); newProduct.Id = lastProductId++; newProduct.Price = GeneratePrice(); newProduct.Quantity = GenerateQuantity(); return newProduct; }
private static Price GeneratePrice(Product owner) { Price newPrice = new Price(); if (owner != null) { newPrice.ProductId = owner.Id; } newPrice.Id = lastPriceId++; newPrice.Value = GeneratePrice(); newPrice.Quantity = GenerateQuantity(); newPrice.Date = DateTime.FromBinary(rnd.Next()).ToString(); return newPrice; }