コード例 #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;
        }
コード例 #2
0
        /// <summary>
        /// 删除收藏
        /// </summary>
        /// <param name="entity">收藏</param>
        public HttpResponseMessage Delete([FromBody]Collection entity)
        {
            if (entity == null)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
            else
            {
                CollectionFunction collectionFunction = new CollectionFunction();
                int error = collectionFunction.DeleteCollection(entity);
                var response = GetResponse.CollectionResponse(error);

                return response;
            }
        }
コード例 #3
0
        /// <summary>
        /// 删除收藏
        /// </summary>
        /// <param name="collectionID">收藏编号</param>
        public HttpResponseMessage Delete(int collectionID)
        {
            if (collectionID == 0)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
            else
            {
                var entity = new Collection() { CollectionID = collectionID };
                CollectionFunction collectionFunction = new CollectionFunction();
                int error = collectionFunction.DeleteCollection(entity);
                var response = GetResponse.CollectionResponse(error);

                return response;
            }
        }
コード例 #4
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();
        }