Exemple #1
0
        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;
        }
Exemple #2
0
        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;
        }
Exemple #3
0
        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;
        }