Exemplo n.º 1
0
        private static void Sell(string[] v)
        {
            string medicineName = v[0];
            string pharmacyName = v[1];

            if (!pharmacies.ContainsKey(pharmacyName) || !medicines.ContainsKey(medicineName))
            {
                Console.WriteLine("Could not sell medicine");
                return;
            }

            Medicine medicine = medicines[medicineName];
            Pharmacy pharmacy = pharmacies[pharmacyName];

            if (pharmacy.Sell(medicine))
            {
                Console.WriteLine($"Sold medicine {medicineName}");
            }
            else
            {
                Console.WriteLine($"Did not sell medicine {medicineName}");
            }
        }
Exemplo n.º 2
0
 public bool Sell(Medicine medicine)
 {
     return(medicines.Remove(medicine));
 }
Exemplo n.º 3
0
 public void Order(Medicine medicine)
 {
     medicines.Add(medicine);
 }