public ProductPriceCalculator(Product product, BuyerStrategy buyerStrategy, DiscountStrategy discountStrategy, Price price) { _product = product; _buyerStrategy = buyerStrategy; _discountStrategy = discountStrategy; _price = price; }
public static DiscountStrategyDto FromDomain(DiscountStrategy strategy) => new DiscountStrategyDto { Id = (int)strategy.Id, Name = (string)strategy.Name, Description = (string)strategy.Description, };
public bool ApplyDiscount(ShoppingCart shoppingCart) { if (shoppingCart.TotalAmount > MinimumAmount) { DiscountStrategy.ApplyDiscount(shoppingCart, DiscountQuantity); return(true); } return(false); }
public bool ApplyDiscount(ShoppingCart shoppingCart) { uint productQuantity = shoppingCart.GetProductQuantityOfCategory(Category); if (productQuantity > MinimumItems) { DiscountStrategy.ApplyDiscount(shoppingCart, DiscountQuantity); return(true); } return(false); }
public decimal CalculateProductDiscount(Product product) { return DiscountStrategy == null ? 0 : DiscountStrategy.GetDiscount(product); }