コード例 #1
0
ファイル: Program.cs プロジェクト: Tapdiq49/C--Final-Project
        static void ShowProductsByPriceRange()
        {
            #region Start Price
            Console.WriteLine("\nMinimum meblegi daxil edin :");
            string startInput = Console.ReadLine();
            double startPrice;

            while (!double.TryParse(startInput, out startPrice))
            {
                Console.WriteLine("Reqem daxil etmelisiniz !");
                startInput = Console.ReadLine();
            }
            #endregion ;

            #region End Price
            Console.WriteLine("Maksimum meblegi daxil edin :");
            string endInput = Console.ReadLine();
            double endPrice;

            while (!double.TryParse(endInput, out endPrice))
            {
                Console.WriteLine("Reqem daxil etmelisiniz!");
                endInput = Console.ReadLine();
            }
            #endregion

            #region Result
            Console.WriteLine("\nDaxil etdiyiniz mebleg araliginda ashagidaki mehsullar movcuddur");
            var table = new ConsoleTable("No", "Adi", "Qiymeti", "Kategoriyasi", "Sayi", "Kodu");
            int i     = 1;
            foreach (var item in _marketableService.GetProductsByPriceRange(startPrice, endPrice))
            {
                table.AddRow(i, item.Name, item.Price.ToString("#.##"), item.ProductCategory, item.Quantity, item.Code);
                i++;
            }
            table.Write();
            #endregion
        }