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); }
public Size GetById(int id) { return(sizeRepository.GetSingleById(id)); }