예제 #1
0
파일: Cart.cs 프로젝트: mezenc3v/VapingShop
        public void AddItem(ElectronicCigarettes cigarettes, int quantity)
        {
            CartLine line = lineCollection
                            .Where(c => c.ElectronicCigarettes.ElectronicCigarettesId == cigarettes.ElectronicCigarettesId)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine {
                    ElectronicCigarettes = cigarettes, Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
예제 #2
0
파일: Cart.cs 프로젝트: mezenc3v/VapingShop
 public void RemoveLine(ElectronicCigarettes cigarettes)
 {
     lineCollection.RemoveAll(l => l.ElectronicCigarettes.ElectronicCigarettesId == cigarettes.ElectronicCigarettesId);
 }