示例#1
0
        private List <orden> allOrders(int userId)
        {
            List <orden> orderss = new List <orden>();
            //encuentro al empleado
            employees employee = context.employees.FirstOrDefault(x => x.userId == userId);
            //encuentro su manager
            managers manager = context.managers.FirstOrDefault(x => x.id == employee.managerId);
            //encuentro el bar de donde es el empleado
            bars bar = context.bars.FirstOrDefault(x => x.id == manager.barId);
            //busco las ordenes por producto de ese bar
            var pbo = context.products_by_order.Where(x => x.products.barId == bar.id).ToList();

            //busco en las ordenes
            context.orders.ToList().ForEach(x =>
            {
                pbo.ForEach(y =>
                {
                    if (x.id == y.orderId)
                    {
                        if (!orderss.Exists(z => z.id == x.id))
                        {
                            orderss.Add(new orden(x));
                        }
                    }
                });
            });
            return(orderss);
        }
        public List <product> getProductsByBarId(int id)
        {
            List <product> list = new List <product>();
            bars           b    = context.bars.FirstOrDefault(x => x.id == id);

            b.products.ToList().ForEach(x => list.Add(new product(x)));
            return(list);
        }
示例#3
0
 public bar(bars bar)
 {
     id          = bar.id;
     name        = bar.name;
     description = bar.description;
     idTypeBar   = bar.idTypeBar;
     typeBarName = bar.bar_types.typeBarName;
     latitude    = bar.latitude;
     longitude   = bar.longitude;
     rate        = bar.rate;
     address     = bar.address;
     pictureId   = bar.pictureId;
 }
        public List <product> getDrinksByBarId(int id)
        {
            List <product> list = new List <product>();
            bars           b    = context.bars.FirstOrDefault(x => x.id == id);

            b.products.ToList().ForEach(x =>
            {
                if (x.products_type.id == CONSTANTES.PRODUCT_TYPE_BEBIDA)
                {
                    list.Add(new product(x));
                }
            });
            return(list);
        }
 public void saveBar(bars b)
 {
     context.bars.Add(b);
     context.SaveChanges();
 }
示例#6
0
 GetAverageDailyTradeVolumeAsync(bars, CancellationToken.None);