I would design the objects as follows. This solution can be copied to a console app to test it.
See it working here[
^]
Notice I've added a stub method for you to check if an item is already added, although the following logic should help you avoid having to check manually and tediously if something is already in a list.
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public void Main()
{
Order order = new Order
{
TableNumber = "Table 1",
Products = new List<Product>
{
new Product { Name = "Item 1", Price = 100.00m, Quantity = 3},
new Product { Name = "Item 2", Price = 89.00m, Quantity = 2},
new Product { Name = "Item 3", Price = 50.00m, Quantity = 1 }
}
};
foreach(var p in order.Products)
{
Console.WriteLine(p.Name + " (Each: " + p.Price + ")" + " - Qty: " + p.Quantity + " (" + p.Total() + ")");
}
}
}
public class Order
{
public List<Product> Products { get; set; }
public string TableNumber{get;set;}
public decimal Total()
{
if (Products.Any())
return Products.Sum(x => x.Price);
return 0.00m;
}
public Order()
{
Products = new List<Product>();
}
public void RemoveProduct()
{
}
public bool IsAdded(string productName)
{
return Products.Any(x=>x.Name.ToLower() == productName.ToLower());
}
}
public class Product
{
public string Name { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
public decimal Total()
{
return Price * Quantity;
}
}