//All products and it's quantities needs to pass the rule, otherwise its illegal public virtual bool Check(ShoppingBasket shoppingBasket) { var v = _r.Method.GetMethodBody(); return(_r(shoppingBasket)); }
public TransactionStatus(string username, Guid storeId, PaymentStatus paymentStatus, DeliveryStatus deliveryStatus, ShoppingBasket shoppingBasket, bool status) { this._paymentStatus = paymentStatus; this._deliveryStatus = deliveryStatus; this.Status = status; this.id = Guid.NewGuid(); this.username = username; this.storeID = storeId; this.ProductHistories = new ProductHistoryData(); var tmpDict = shoppingBasket?.GetDictionaryProductQuantity() ?? new HashSet <UserPackage.ProductInCart>(); foreach (var p_q in tmpDict) { ProductHistories.Add(p_q.product, p_q.quantity); } }