示例#1
0
        public void AddItem(Cart cart, Product product, int sizeId, int quantity)
        {
            CartLine line = cart.cartLines
                            .Where(p => p.Product.ID == product.ID && p.Size.Id == sizeId)
                            .FirstOrDefault();
            var size = _sizeRepository.GetSingleById(sizeId);

            if (line == null)
            {
                cart.cartLines.Add(new CartLine
                {
                    Product  = product,
                    Size     = size,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
        public void DeleteSize(int id)
        {
            var model = _sizeRepository.GetSingleById(id);

            _sizeRepository.Delete(model);
        }
示例#3
0
 public Size GetById(int id)
 {
     return(sizeRepository.GetSingleById(id));
 }