Example #1
0
 public void AddProduct(Product product)
 {
     if (!ProductsInInvoice.Exists(e => e.ID == product.ID) && product != null)
     {
         ProductsInInvoice.Add(product);
     }
     else if (product != null)
     {
         Product temp         = ProductsInInvoice.Find(e => e.ID == product.ID);
         int     qauntitytemp = temp.GetProductPurchasedQuantity() + product.GetProductPurchasedQuantity();
         temp.SetProductPurchasedQuantity(qauntitytemp);
         int index = ProductsInInvoice.FindIndex(e => e.ID == temp.ID);
         ProductsInInvoice[index] = temp;
     }
 }
Example #2
0
 public void RemoveProduct(int id) => ProductsInInvoice.Remove(ProductsInInvoice.Find(products => products.ID == id));
Example #3
0
 public Product GetProduct(int id)
 {
     return(ProductsInInvoice.Find(product => product.ID == id));
 }