Ejemplo n.º 1
0
        /// <summary>
        /// 查询收藏
        /// </summary>
        /// <returns>收藏,总页数</returns>
        public IEnumerable<object> Get()
        {
            int totalPage = 0;
            List<Collection> result = new List<Collection>();

            var queryString = Request.GetQueryNameValuePairs();
            var queryConditions = new CollectionQueryConditions();
            queryConditions.GetValues(queryString);

            CollectionFunction collectionFunction = new CollectionFunction();
            collectionFunction.QueryCollections(queryConditions, out result, out totalPage);

            List<object> objectResult = new List<object>() { result, new { totalPage = totalPage } };
            return objectResult;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询单个收藏
        /// </summary>
        /// <param name="collectionID">收藏编号</param>
        /// <returns>收藏</returns>
        public Collection Get(int collectionID)
        {
            int totalPage = 0;
            List<Collection> result = new List<Collection>();

            var queryConditions = new CollectionQueryConditions() { CollectionID = collectionID };

            CollectionFunction collectionFunction = new CollectionFunction();
            collectionFunction.QueryCollections(queryConditions, out result, out totalPage);

            return result.FirstOrDefault();
        }
Ejemplo n.º 3
0
        //查询收藏
        public int QueryCollections(CollectionQueryConditions queryConditions, out List<Collection> result, out int totalPage)
        {
            using (var db = new HouseMarketEntities())
            {
                totalPage = 0;

                var entities = db.Collections;
                var query = SetQuery(entities, queryConditions, out totalPage);
                result = query.ToList();

                return 0;
            }
        }