public override UpdateCartLineResult Execute(IUnitOfWork unitOfWork, UpdateCartLineParameter parameter, UpdateCartLineResult result) { //update piricing for Volume group CustomerOrder cart = result.GetCartLineResult.GetCartResult.Cart; CartLineDto cartLineDto = parameter.CartLineDto; if (cartLineDto == null) { return(result); } OrderLine orderLine = unitOfWork.GetRepository <OrderLine>().Get(cartLineDto.OrderLineId); if (orderLine == null) { return(this.CreateErrorServiceResult <UpdateCartLineResult>(result, SubCode.NotFound, MessageProvider.Current.Cart_OrderLineNotFound)); } if (result.GetCartLineResult.BreakPrices.Count > 1) { string QtyBrkCls = unitOfWork.GetRepository <Product>().GetTable().FirstOrDefault(x => x.Id == orderLine.ProductId).PriceBasis; orderLine.ConfigurationViewModel = "true"; if (!string.IsNullOrEmpty(QtyBrkCls)) { CartHelper_Brasseler helper = new CartHelper_Brasseler(this.pricingPipeline); //update cartline with updated volume grp price & promotion result.GetCartLineResult.GetCartResult.Cart = helper.UpdateVolumeGrpPricing(cart, QtyBrkCls, unitOfWork); } } //Common promotion recalculate logic - BUSA-683 result.GetCartLineResult.GetCartResult.Cart.RecalculatePromotions = true; result.GetCartLineResult.GetCartResult.Cart.RecalculateTax = true; this.PromotionEngine.ApplyPromotions(result.GetCartLineResult.GetCartResult.Cart); return(this.NextHandler.Execute(unitOfWork, parameter, result)); }
public static CartLine MapFromDto(CartLineDto source) => new CartLine { Id = source.Id, TimeStamp = source.TimeStamp, Product = MapFromDto(source.Product), Quantity = source.Quantity };
public virtual async Task AddItem(ProductDto product, int quantity) { CartLineDto line = lineCollection .Where(p => p.ProductDto.Id == product.Id) .FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLineDto(product, quantity)); } else { line.Quantity += quantity; } await Task.CompletedTask; }
public virtual void AddItem(ProductDto product, int quantity) { CartLineDto line = _lineCollection .Find(p => p.Product.Id == product.Id); if (line == null) { _lineCollection.Add(new CartLineDto { Product = product, Quantity = quantity }); } else { line.Quantity += quantity; } }
public virtual void AddItem(ProductDto product, int quantity) { CartLineDto line = lineCollection .Where(p => p.Product.ProductId == product.ProductId) .FirstOrDefault(); if (line == null) { lineCollection.Add(new CartLineDto { Product = product, Quantity = quantity }); } else { line.Quantity += quantity; } }