public bool UpdatePrice(Product product, int priceId, ProductPrice newPrice) { var price = product.FindPrice(priceId); if (price == null) { return false; } price.UpdateFrom(newPrice); _db.SaveChanges(); price.NotifyUpdated(); return true; }
public bool PublishPrice(Product product, int priceId) { var price = product.FindPrice(priceId); if (price.MarkPublish()) { _db.SaveChanges(); Event.Raise(new ProductPricePublished(product, price)); return true; } return false; }
public bool RemovePrice(Product product, int priceId) { var price = product.FindPrice(priceId); if (price == null) { return false; } product.PriceList.Remove(price); _db.GetRepository<ProductPrice>().Delete(price); _db.SaveChanges(); Event.Raise(new ProductPriceDeleted(product, price)); return true; }