Exemplo n.º 1
0
        public async void FillOrders()
        {
            var orderDs = new OrderDataService();

            var rnd = new Random();
            var dt  = new DateTime(2019, 7, 5);

            while (true)
            {
                dt = dt.AddDays(rnd.Next(3, 8));
                if (dt >= DateTime.Now)
                {
                    break;
                }

                var order = new Order
                {
                    isOrder      = true,
                    report_date  = dt,
                    shop_id      = 2,
                    OrderDetails = new List <OrderDetail>
                    {
                        new OrderDetail {
                            prod_id = 1194, cost = rnd.Next(800, 1200), count = rnd.Next(2, 8)
                        },
                        new OrderDetail {
                            prod_id = 1201, cost = rnd.Next(1750, 2150), count = rnd.Next(2, 5)
                        },
                        new OrderDetail {
                            prod_id = 1212, cost = rnd.Next(2350, 2850), count = rnd.Next(2, 5)
                        }
                    }
                };

                var id = await orderDs.Insert(order);
            }
        }