using System.Collections.Generic;
public static void Main()
ConsignmentShop consignmentShop = new ConsignmentShop();
consignmentShop.ShowMenu();
public string Name {get;set;}
public string Description {get;set;}
public decimal Price {get;set;}
public bool IsSold {get;set;}
public bool IsPaymentDone {get;set;}
public Vendor Vendor {get;set;}
public int Stock {get;set;}
public override string ToString(){
return "Name : " + this.Name + "Price : $" + this.Price;
public string FirstName {get;set;}
public string LastName {get;set;}
public decimal Commission {get;set;}
public decimal PaymentDue {get;set;}
public override string ToString(){
return this.FirstName + " " + this.LastName;
public string Name{get;set;}
public string City{get;set;}
public string ZipCode{get;set;}
public string Country{get;set;}
public string Address1{get;set;}
public string Address2{get;set;}
private List<Item> items ;
private List<Vendor> vendors ;
public List<Vendor> Vendors{
this.Items = new List<Item>();
this.Vendors = new List<Vendor>();
public void AddItem(Item _item){
public void AddVendor(Vendor _vendor){
this.Vendors.Add(_vendor);
public class ConsignmentShop{
private Dictionary<Item, int> itemsInShoppingCart {get;set;}
private Store _Store {get;set;}
public ConsignmentShop(){
this.itemsInShoppingCart = new Dictionary<Item, int>();
private void SetUpStore(){
this._Store = new Store{Name = "Cool Store"};
this._Store.AddVendor(new Vendor{FirstName = "Vladimir", LastName = "Gerasimenok", Commission = 0.2m, PaymentDue = 0});
this._Store.AddVendor(new Vendor{FirstName = "Raja", LastName = "Mani", Commission = 0.3m, PaymentDue = 0});
this._Store.AddItem(new Item{Name = "C# in a Nutshell", Description = "A book from O'Reiley", Price = 50.0m, IsSold = false, IsPaymentDone = false, Vendor = this._Store.Vendors[0], Stock = 10});
this._Store.AddItem(new Item{Name = "Apple AirPods", Description = "Headphones from Apple", Price = 250.0m, IsSold = false, IsPaymentDone = false, Vendor = this._Store.Vendors[1], Stock = 5});
this._Store.AddItem(new Item{Name = "Samsung Galyx S20+", Description = "Samsung phone", Price = 1200.0m, IsSold = false, IsPaymentDone = false, Vendor = this._Store.Vendors[0], Stock = 3});
this._Store.AddItem(new Item{Name = "iMac 2011", Description = "A computer from Apple", Price = 575.0m, IsSold = false, IsPaymentDone = false, Vendor = this._Store.Vendors[1], Stock = 2});
this._Store.AddItem(new Item{Name = "AOC AG352UCG", Description = "AOC Ultrawide monitor", Price = 790.0m, IsSold = false, IsPaymentDone = false, Vendor = this._Store.Vendors[0], Stock = 5});
Console.WriteLine("Welcome to {0}",this._Store.Name);
foreach(var item in this._Store.Items){
Console.WriteLine(lineItem +". " + item.Name);
Console.WriteLine("A - Add item to shoppping cart");
Console.WriteLine("L - List items in shoppping cart");
Console.WriteLine("O - Order items in shopping cart");
Console.WriteLine("X - Exit");
Console.WriteLine("Enter your choice");
Choice = Console.ReadLine();
Console.WriteLine("Enter item number, quantity");
string Data = Console.ReadLine();
int ItemNumber = int.Parse(Data.Split(',')[0]);
int ItemQuantity = int.Parse(Data.Split(',')[1]);
int AvailableQuantity = this._Store.Items[ItemNumber - 1].Stock;
if(AvailableQuantity >= ItemQuantity)
this.itemsInShoppingCart.Add(this._Store.Items[ItemNumber - 1], ItemQuantity);
this._Store.Items[ItemNumber - 1].Stock -= ItemQuantity;
Console.WriteLine(ItemQuantity + " Not Available right now. We have " + this._Store.Items[ItemNumber - 1].Stock + " available in the shop");
foreach(var item in this.itemsInShoppingCart){
Console.WriteLine(item.Key.Name + " " + item.Key.Price + " X " + item.Value + " = " + item.Key.Price * item.Value);
foreach(var item in this.itemsInShoppingCart){
item.Key.Vendor.PaymentDue += item.Key.Price * item.Value * item.Key.Vendor.Commission;
StoreProfit += (int)((item.Key.Price * item.Value) - (item.Key.Price * item.Value * item.Key.Vendor.Commission));
Console.WriteLine("StoreProfit : " + StoreProfit + "\n");
foreach(var item in this._Store.Vendors){
Console.WriteLine(item.FirstName + " " +item.LastName + " " + item.PaymentDue + "$");