public void Edit(int categoryId, string name, string description, Price price, string imageUrl) { this.CategoryId = categoryId; this.Name = name; this.Description = description; this.Price = price; this.ImageUrl = imageUrl; }
public Product(int categoryId, string name, string description, string imageUrl, Price price, int? id = null) { this.CategoryId = categoryId; this.Name = name; this.Description = description; this.ImageUrl = imageUrl; this.Price = price; this.Id = id ?? 0; }
public Product(int categoryId, string name, string description, string imageUrl, Price price) { price.ValidateNotNullParameter("price"); this.CategoryId = categoryId; this.Name = name; this.Description = description; this.ImageUrl = imageUrl; this.ExactPrice = price.ExactPrice; this.FromPrice = price.FromPrice; this.ToPrice = price.ToPrice; }
private static Price GetPrice(Db.Product db) { Price price = null; if (db.ExactPrice.HasValue) { price = new Price(db.ExactPrice.Value); } else if (db.FromPrice.HasValue && db.ToPrice.HasValue) { price = new Price(db.FromPrice.Value, db.ToPrice.Value); } return price; }