Example #1
0
        /// <summary>
        /// 查询类型商品
        /// </summary>
        /// <returns></returns>
        public ActionResult selectAll()
        {
            ComTypeManager c     = new ComTypeManager();
            var            list  = c.GetEntitysWhere(x => x.ComTypeParId == 1);
            var            list1 = list.Select(x => new {
                x.Id,
                x.ComTypeName,
                x.ComTypeParId,
                x.ComTypeUrl,
                listtwo = x.ComType1.Select(y => new {
                    y.Id,
                    y.ComTypeName,
                    y.ComTypeParId,
                    y.ComTypeUrl,
                    listhree = y.ComType1.Select(z => new
                    {
                        z.Id,
                        z.ComTypeName,
                        z.ComTypeParId,
                        z.ComTypeUrl,
                        listcom = z.Com.Select(w => new {
                            w.Id,
                            w.ComWeight,
                            w.ComName,
                            w.ComBz,
                            w.ComMoney,
                            w.ComTypeId,
                            w.ComStatic
                        })
                    })
                })
            });

            return(Json(list1, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult selecByAll(int Id)
        {
            ComTypeManager c     = new ComTypeManager();
            var            list  = c.GetEntitysWhere(x => x.ComTypeParId == Id);
            var            list1 = list.Select(x => new {
                x.Id,
                x.ComTypeName,
                x.ComTypeParId,
                x.ComTypeUrl,
            });

            return(Json(list1, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        /// <summary>
        /// 根据类型ID查询商品
        /// </summary>
        /// <returns></returns>
        public ActionResult selectCom()
        {
            ComTypeManager cc   = new ComTypeManager();
            var            list = cc.GetEntitysWhere(x => x.Id == idd2);
            List <Com>     com  = new List <Com>();

            foreach (var item1 in list)
            {
                if (item1.ComTypeParId == 1)
                {
                    foreach (var item2 in item1.ComType1)
                    {
                        foreach (var item3 in item2.ComType1)
                        {
                            com.AddRange(item3.Com);
                        }
                    }
                }
                else if (item1.ComTypeParId != 1)
                {
                    List <ComType> com2 = cc.GetEntitysWhere(x => x.ComTypeParId == item1.Id);//用来判断是第二层还是第三层  集合为空就是第三层反之就是第二层
                    if (com2.Count != 0)
                    {
                        foreach (var item2 in item1.ComType1)
                        {
                            com.AddRange(item2.Com);
                        }
                    }
                    else
                    {
                        com.AddRange(item1.Com);
                    }
                }
            }
            return(PartialView(com));
        }
Example #4
0
        public ActionResult Index()
        {
            try
            {
                ComTypeManager com = new ComTypeManager();

                List <ComType> dht = com.GetEntitysWhere(x => x.ComTypeParId == 1);
                Session["qwe"] = dht;
                return(PartialView());
            }
            catch (Exception e)
            {
                string msg = e.ToString();
                return(PartialView(e.ToString()));
            }
        }
Example #5
0
        public ActionResult selectType()
        {
            ComTypeManager cc    = new ComTypeManager();
            var            list  = cc.GetEntitysWhere(x => x.ComTypeParId == idd1);
            var            list1 = list.Select(x => new
            {
                x.Id,
                x.ComTypeName,
                x.ComTypeParId,
                list2 = x.ComType1.Select(y => new
                {
                    y.Id,
                    y.ComTypeName,
                    y.ComTypeParId
                })
            });;

            return(Json(list1, JsonRequestBehavior.AllowGet));
        }