예제 #1
0
        /// <summary>
        /// 删除房屋
        /// </summary>
        /// <param name="houseID">房屋编号</param>
        public HttpResponseMessage Delete(int houseID)
        {
            if (houseID == 0)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
            else
            {
                var houseFunction = new HouseFunction();
                int error = houseFunction.DeleteHouse(houseID);
                var response = GetResponse.HouseResponse(error);

                return response;
            }
        }
예제 #2
0
        /// <summary>
        /// 查询房屋
        /// </summary>
        /// <returns>房屋视图,总页数</returns>
        public IEnumerable<object> Get()
        {
            int totalPage = 0;
            List<View_HouseAddress> result = new List<View_HouseAddress>();

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

            HouseFunction houseFunction = new HouseFunction();
            houseFunction.QueryHouses(queryConditions, out result, out totalPage);

            List<object> objectResult = new List<object>() { result, new { totalPage = totalPage } };
            return objectResult;
        }
예제 #3
0
        /// <summary>
        /// 删除房屋
        /// </summary>
        /// <param name="entity">房屋视图</param>
        public HttpResponseMessage Delete([FromBody]View_HouseAddress entity)
        {
            if (entity == null)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
            else
            {
                var houseFunction = new HouseFunction();
                int error = houseFunction.DeleteHouse(entity);
                var response = GetResponse.HouseResponse(error);

                return response;
            }
        }
예제 #4
0
        /// <summary>
        /// 查询单个房屋
        /// </summary>
        /// <param name="houseID">房屋编号</param>
        /// <returns>房屋视图</returns>
        public View_HouseAddress Get(int houseID)
        {
            int totalPage = 0;
            List<View_HouseAddress> result = new List<View_HouseAddress>();

            HouseQueryConditions queryConditions = new HouseQueryConditions() { HouseID = houseID };
            HouseFunction houseFunction = new HouseFunction();
            houseFunction.QueryHouses(queryConditions, out result, out totalPage);

            return result.FirstOrDefault();
        }