Esempio n. 1
0
        public void RemoveClothe(RemoveClotheParam param)
        {
            var clotheToAdd = Stores.FirstOrDefault(w => w.Name == param.Name &&
                                                    w.Size == param.Size &&
                                                    w.Color == param.Color);

            if (clotheToAdd != null && clotheToAdd.Quantity > 0)
            {
                clotheToAdd.Quantity -= param.Quantity;
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ShowStores();
            //ShowClothes();

            Console.WriteLine("- Key in which clothe type you want to buy with option below:");
            Console.WriteLine("---- 1 for T-Shirt");
            Console.WriteLine("---- 2 for Dress Shirt");
            var type = Console.ReadLine();

            Console.WriteLine("- Key in which clothe size you want to buy with option below:");
            Console.WriteLine("---- 1 for S (Small)");
            Console.WriteLine("---- 2 for M (Medium)");
            var size = Console.ReadLine();

            Console.WriteLine("- Key in which clothe color you want to buy with option below:");
            Console.WriteLine("---- 1 for Red");
            Console.WriteLine("---- 2 for Blue");
            var color = Console.ReadLine();

            Console.WriteLine("- You have select clothe with below option:");
            ShowTypeOption(type);
            ShowSizeOption(size);
            ShowColorOption(color);
            Console.WriteLine("---- Quantity default is 1");

            var removeClotheParam = new RemoveClotheParam();

            removeClotheParam.Name  = GetTypeOption(type);
            removeClotheParam.Size  = GetSizeOption(size);
            removeClotheParam.Color = GetColorOption(color);

            _storeService.RemoveClothe(removeClotheParam);

            Console.WriteLine("---------------------- Your order is successfully placed!");

            //ShowStores();

            Console.ReadLine();
        }