Example #1
0
        public static OrderlineModel Create(
            CartItemModel cartItem)
        {
            var orderLine = new OrderlineModel
            {
                Deal = cartItem.Deal,
                DealOption = cartItem.DealOption
            };

            foreach (var attr in cartItem.AttributeValues)
            {
                orderLine.attributeValues.Add(attr);
            }

            orderLine.Key = Guid.NewGuid().ToString();
            orderLine.SpecialPrice = cartItem.DealOption.SpecialPrice * cartItem.Quantity;
            orderLine.RegularPrice = cartItem.DealOption.RegularPrice * cartItem.Quantity;
            orderLine.Quantity = cartItem.Quantity;

            return orderLine;
        }
Example #2
0
        public static CartItemModel Create(
            DealModel deal,
            DealOptionModel dealOption,
            List<DealAttributeModel> selectedAttributeValues)
        {
            var cartItemModel = new CartItemModel
            {
                Deal = deal,
                DealOption = dealOption,
                Quantity = 1
            };

            foreach (var attr in selectedAttributeValues)
            {
                cartItemModel.attributeValues.Add(attr);
            }

            cartItemModel.Key = Guid.NewGuid().ToString();

            return cartItemModel;
        }
Example #3
0
 private static void AssertModelEqualityWithDeal(
     CartItemViewModel viewModel,
     CartItemModel domainModel,
     DealModel dealModel)
 {
     viewModel.DealId.ShouldBeEquivalentTo(dealModel.Key);
     viewModel.DealThumbnailUrl.ShouldBeEquivalentTo(dealModel.Images.OrderBy(a => a.Order).First().RelativeUrl);
     viewModel.DealUrl.ShouldBeEquivalentTo(dealModel.CanonicalUrl);
     viewModel.Id.ShouldBeEquivalentTo(domainModel.Key);
 }
Example #4
0
 private static void AssertModelEquality(CartItemViewModel viewModel, CartItemModel domainModel)
 {
     viewModel.Id.ShouldBeEquivalentTo(domainModel.Key.ToString());
 }
Example #5
0
 public void RemoveFromCart(CartItemModel cartItem)
 {
     this.cartItems.Remove(cartItem);
 }
Example #6
0
 public void AddToCart(CartItemModel cartItem)
 {
     this.cartItems.Add(cartItem);
 }