Ejemplo n.º 1
0
 static void AwesomeGiftToMYself()
 {
     Console.WriteLine("Вот шо есть для меня любимого");
     using (var context = new ProductDbContext())
     {
         var myself = context.ProductDBList.OrderBy(x => x.Price).Last();
         Console.WriteLine($" {myself.Name} {myself.Price}");
         GetSite(myself);
         Console.ReadLine();
     }
 }
Ejemplo n.º 2
0
 static void GiftForTescha()
 {
     Console.WriteLine("Вот шо есть для любимой тещеньки");
     using (var context = new ProductDbContext())
     {
         var teschaGift = context
                          .ProductDBList.OrderBy(x => x.Price).First();
         Console.WriteLine($" {teschaGift.Name} {teschaGift.Price}");
         GetSite(teschaGift);
         Console.ReadLine();
     }
 }
Ejemplo n.º 3
0
 static void Deshman()
 {
     Console.WriteLine("Вот шо есть по дешману");
     using (var context = new ProductDbContext())
     {
         var selectedProducts = context
                                .ProductDBList.Where(x => x.Price < 10.00).ToList();
         foreach (var product in selectedProducts)
         {
             Console.WriteLine($"{product.Id} {product.Name}  {product.Price}  ");
         }
         SelectMenu(selectedProducts);
     }
 }
Ejemplo n.º 4
0
 static void GiftGetAll25Byn()
 {
     Console.WriteLine("вывести список подарков с ценой до 25 рублей");
     using (var context = new ProductDbContext())
     {
         foreach (var product in context.ProductDBList)
         {
             if (product.Price < 25.00)
             {
                 Console.WriteLine($"{product.Id} {product.Name} {product.Price}");
             }
         }
         Console.ReadLine();
     }
 }
Ejemplo n.º 5
0
            static void GiftGetAllCost()
            {
                Console.WriteLine("посчитать сколько будут стоить все подарки");
                using (var context = new ProductDbContext())
                {
                    double summCost = 0.00;
                    foreach (var product in context.ProductDBList)
                    {
                        summCost += product.Price;
                    }
                    Console.WriteLine($"за все {summCost:00.00}, даж вывел кросево");

                    Console.ReadLine();
                }
            }
Ejemplo n.º 6
0
            static void FillProductsDB(products products)
            {
                using (var context = new ProductDbContext())
                {
                    foreach (var product in products.Products)
                    {
                        context.ProductDBList.Add(new ProductDB()
                        {
                            Name  = product.Name,
                            Price = product.Prices.Price_min.CashInDouble,
                            Url   = product.Url
                        });
                    }


                    context.SaveChanges();
                }
            }
Ejemplo n.º 7
0
 static void GiftDeshman50BYN()
 {
     Console.WriteLine("выбрать самые дешевые подарки пока не закончатся 50 рублей, вывести список подарков");
     using (var context = new ProductDbContext())
     {
         var    ordered      = context.ProductDBList.OrderBy(x => x.Price).ToList();
         double summCost     = 0.00;
         var    Deshman50Byn = new List <ProductDB>();
         int    i            = 0;
         while ((50.00 - summCost) > ordered[i].Price)
         {
             summCost += ordered[i].Price;
             Deshman50Byn.Add(ordered[i]);
             i++;
         }
         foreach (var product in Deshman50Byn)
         {
             Console.WriteLine($"{product.Id}  {product.Name}  {product.Price}");
         }
         SelectMenu(Deshman50Byn);
         Console.ReadLine();
     }
 }