当前位置: 首页>>代码示例>>C#>>正文


C# List.AsQueryable方法代码示例

本文整理汇总了C#中Model.List.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# List.AsQueryable方法的具体用法?C# List.AsQueryable怎么用?C# List.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model.List的用法示例。


在下文中一共展示了List.AsQueryable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAnything

        public IQueryable<House> GetAnything(int id, int a)
        {
            var house = new House();
            var house1 = new House();
            var glaus = new Animal { Name = "Glaus", Age = id, Size = a };
            var tiger = new Animal { Name = "Tiger", Age = id, Size = a };
            house.Animals = new List<Animal> { glaus, glaus };
            house1.Animals = new List<Animal> { tiger, tiger };
            var houses = new List<House> { house, house1 };

            return houses.AsQueryable();
        }
开发者ID:rfe-nosi,项目名称:WebAPI,代码行数:12,代码来源:ValuesController.cs

示例2: Loadatt_file

 public IQueryable<Attfile_entity> Loadatt_file(int _newsID)
 {
     try
     {
         List<Attfile_entity> l=new List<Attfile_entity>();
         var list = (from a in db.ESHOP_EXT_FILEs
                     join b in db.ESHOP_NEWS_ATTs on a.EXT_FILE_ID equals b.EXT_ID
                     where b.NEWS_ID == _newsID
                     select new
                     {
                         EXT_FILE_IMAGE = a.EXT_FILE_IMAGE,
                         NEWS_ATT_FILE = b.NEWS_ATT_FILE,
                         NEWS_ATT_URL = b.NEWS_ATT_URL,
                         NEWS_ATT_NAME = b.NEWS_ATT_NAME,
                         EXT_ID = b.EXT_ID,
                         NEWS_ID = b.NEWS_ID
                     });
         foreach (var i in list)
         {
             Attfile_entity att = new Attfile_entity();
             att.EXT_FILE_IMAGE = i.EXT_FILE_IMAGE;
             att.NEWS_ATT_FILE = i.NEWS_ATT_FILE;
             att.NEWS_ATT_URL = i.NEWS_ATT_URL;
             att.NEWS_ATT_NAME = i.NEWS_ATT_NAME;
             att.EXT_ID =Utils.CIntDef(i.EXT_ID);
             att.NEWS_ID = Utils.CIntDef(i.NEWS_ID);
             l.Add(att);
         }
         return l.AsQueryable();
     }
     catch (Exception)
     {
         
         throw;
     }
 }
开发者ID:htphongqn,项目名称:websitegiaoxu,代码行数:36,代码来源:Attfile.cs

示例3: Load_pro_index_cate

 public IQueryable<Pro_details_entity> Load_pro_index_cate(object catid,int limit)
 {
     try
     {
         int id = Utils.CIntDef(catid);
         List<Pro_details_entity> l = new List<Pro_details_entity>();
         var list = (from a in db.ESHOP_NEWS_CATs
                     join b in db.ESHOP_NEWs on a.NEWS_ID equals b.NEWS_ID
                     join c in db.ESHOP_CATEGORies on a.CAT_ID equals c.CAT_ID
                     where c.CAT_ID==id||c.CAT_PARENT_PATH.Contains(id.ToString())
                     select new { b.NEWS_ID, b.NEWS_TITLE, b.NEWS_IMAGE3, b.NEWS_PRICE1, b.NEWS_DESC, b.NEWS_SEO_URL, b.NEWS_URL, b.NEWS_ORDER_PERIOD, b.NEWS_PUBLISHDATE, c.CAT_SEO_URL }).OrderByDescending(n => n.NEWS_PUBLISHDATE).OrderByDescending(n => n.NEWS_ORDER_PERIOD).Take(limit).ToList();
         foreach (var i in list)
         {
             Pro_details_entity pro = new Pro_details_entity();
             pro.NEWS_ID = i.NEWS_ID;
             pro.NEWS_TITLE = i.NEWS_TITLE;
             pro.NEWS_IMAGE3 = i.NEWS_IMAGE3;
             pro.NEWS_DESC = i.NEWS_DESC;
             pro.NEWS_SEO_URL = i.NEWS_SEO_URL;
             pro.NEWS_URL = i.NEWS_URL;
             pro.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1);
             pro.NEWS_ORDER_PERIOD = Utils.CIntDef(i.NEWS_ORDER_PERIOD);
             pro.NEWS_PUBLISHDATE = Utils.CDateDef(i.NEWS_PUBLISHDATE, DateTime.Now);
             pro.CAT_SEO_URL = i.CAT_SEO_URL;
             l.Add(pro);
         }
         return l.AsQueryable();
     }
     catch (Exception)
     {
         
         throw;
     }
 }
开发者ID:htphongqn,项目名称:websitegiaoxu,代码行数:34,代码来源:Home.cs

示例4: load_ordePaymentFinalobj

        public IQueryable<Order_entity> load_ordePaymentFinalobj(object id)
        {
            int _id = Utils.CIntDef(id);
            List<Order_entity> l = new List<Order_entity>();
            var list = (from a in db.ESHOP_ORDERs
                        join b in db.ESHOP_ORDER_ITEMs on a.ORDER_ID equals b.ORDER_ID
                        join c in db.ESHOP_NEWs on b.NEWS_ID equals c.NEWS_ID
                        where a.ORDER_ID == _id
                        select new
                        {
                            c.NEWS_TITLE,
                            a.ORDER_NAME,
                            a.ORDER_PHONE,
                            a.ORDER_ID,
                            c.NEWS_SEO_URL,
                            c.NEWS_URL,
                            c.NEWS_IMAGE3,
                            a.ORDER_ADDRESS,
                            c.NEWS_ID,
                            c.NEWS_PRICE1,
                            c.NEWS_PRICE2,
                            a.ORDER_CODE,
                            a.ORDER_SHIPPING_FEE,
                            a.ORDER_TOTAL_AMOUNT,
                            a.ORDER_TOTAL_ALL,
                            b.ITEM_QUANTITY,
                            b.ITEM_SUBTOTAL,
                            b.ITEM_PRICE

                        }).OrderByDescending(n => n.ORDER_ID);
            foreach (var i in list)
            {
                Order_entity order = new Order_entity();
                order.NEWS_SEO_URL = i.NEWS_SEO_URL;
                order.NEWS_URL = i.NEWS_URL;
                order.ORDER_NAME = i.ORDER_NAME;
                order.ORDER_PHONE = i.ORDER_PHONE;
                order.NEWS_TITLE = i.NEWS_TITLE;
                order.NEWS_IMAGE3 = i.NEWS_IMAGE3;
                order.NEWS_ID = Utils.CIntDef(i.NEWS_ID);
                order.ORDER_ADDRESS = i.ORDER_ADDRESS;
                order.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1);
                order.NEWS_PRICE2 = Utils.CDecDef(i.NEWS_PRICE2);
                order.ORDER_CODE = i.ORDER_CODE;
                order.ORDER_SHIPPING_FEE = Utils.CDecDef(i.ORDER_SHIPPING_FEE);
                order.ITEM_PRICE = Utils.CDecDef(i.ITEM_PRICE);
                order.ITEM_SUBTOTAL = Utils.CDecDef(i.ITEM_SUBTOTAL);
                order.ITEM_QUANTITY = Utils.CIntDef(i.ITEM_QUANTITY);
                order.ORDER_TOTAL_AMOUNT = Utils.CDecDef(i.ORDER_TOTAL_AMOUNT);
                order.ORDER_TOTAL_ALL = Utils.CDecDef(i.ORDER_TOTAL_ALL);
                l.Add(order);
            }
            return l.AsQueryable();
        }
开发者ID:htphongqn,项目名称:esell.yeuthietkeweb.com,代码行数:54,代码来源:HistoryPayment.cs

示例5: Load_pro_index_cate

        public IQueryable<Pro_details_entity> Load_pro_index_cate(object catid, int per, int skip, int limit)
        {
            try
            {
                int id = Utils.CIntDef(catid);
                List<Pro_details_entity> l = new List<Pro_details_entity>();
                var list = (from a in db.ESHOP_NEWS_CATs
                            join b in db.ESHOP_NEWs on a.NEWS_ID equals b.NEWS_ID
                            join c in db.ESHOP_CATEGORies on a.CAT_ID equals c.CAT_ID
                            where (c.CAT_ID == id || c.CAT_PARENT_PATH.Contains(id.ToString())) & b.NEWS_FIELD1 == per.ToString()
                            select new { b.NEWS_COUNT, b.NEWS_VIDEO_URL, b.NEWS_FIELD3, b.NEWS_FIELD1, b.NEWS_FIELD2, b.NEWS_ID, b.NEWS_TITLE, b.NEWS_IMAGE3, b.NEWS_DESC, b.NEWS_SEO_URL, b.NEWS_PRICE2, b.NEWS_PRICE1, b.NEWS_URL, b.NEWS_ORDER, b.NEWS_PUBLISHDATE }).Distinct().OrderByDescending(n => n.NEWS_PUBLISHDATE).OrderByDescending(n => n.NEWS_ORDER).Skip(skip).Take(limit).ToList();
                foreach (var i in list)
                {
                    Pro_details_entity pro = new Pro_details_entity();
                    pro.NEWS_VIDEO_URL = i.NEWS_VIDEO_URL;
                    pro.NEWS_ID = i.NEWS_ID;
                    pro.NEWS_COUNT = Utils.CIntDef(i.NEWS_COUNT);
                    pro.NEWS_TITLE = i.NEWS_TITLE;
                    pro.NEWS_IMAGE3 = i.NEWS_IMAGE3;
                    pro.NEWS_DESC = i.NEWS_DESC;
                    pro.NEWS_SEO_URL = i.NEWS_SEO_URL;
                    pro.NEWS_URL = i.NEWS_URL;
                    pro.NEWS_ORDER = Utils.CIntDef(i.NEWS_ORDER);
                    pro.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1);
                    pro.NEWS_PRICE2 = Utils.CDecDef(i.NEWS_PRICE2);
                    pro.NEWS_PUBLISHDATE = Utils.CDateDef(i.NEWS_PUBLISHDATE, DateTime.Now);
                    pro.NEWS_FIELD1 = i.NEWS_FIELD1;
                    pro.NEWS_FIELD2 = i.NEWS_FIELD2;
                    pro.NEWS_FIELD3 = i.NEWS_FIELD3;
                    l.Add(pro);
                }
                return l.AsQueryable();
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:htphongqn,项目名称:xinlinktube.com,代码行数:39,代码来源:Home.cs


注:本文中的Model.List.AsQueryable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。