public IHttpActionResult GetItemByClient(BaseCondition <RoomResult> condition, int HotelId)
        {
            ApiResult <HotelResult> rs = hotelDAL.GetItemByClient(HotelId);

            if (condition == null)
            {
                condition = new BaseCondition <RoomResult>()
                {
                    PageIndex = 1,
                    PageSize  = 10,
                };
            }
            ;
            condition.FilterRules = new List <FilterItems>();
            FilterItems FilterItems = new FilterItems
            {
                field = "R.HotelId",
                op    = "=",
                value = HotelId.ToString()
            };

            condition.FilterRules.Add(FilterItems);
            ApiResult <RoomResult> ListRoom = roomDAL.GetPaging(condition);

            if (ListRoom.Succeeded)
            {
                rs.Data.ListRoom = ListRoom.DataList;
                rs.TotalRecords  = ListRoom.TotalRecords;
            }
            if (!rs.Succeeded)
            {
                return(Content(HttpStatusCode.BadRequest, rs));
            }
            return(Ok(rs));
        }
        public IHttpActionResult GetPaging(BaseCondition <RoomResult> condition)
        {
            List <FilterItems> FilterRules = condition.FilterRules;
            List <SortItems>   SortRules   = condition.SortRules;

            if (FilterRules != null && FilterRules.Count > 0)
            {
                foreach (var item in FilterRules.Select((value, i) => new { i, value }))
                {
                    FilterItems e     = item.value;
                    int         Index = item.i;
                    if (e.field == "HotelName")
                    {
                        condition.FilterRules[Index].field = "H.Name";
                    }
                    else
                    {
                        condition.FilterRules[Index].field = "R." + e.field;
                    }
                }
            }

            if (SortRules != null && SortRules.Count > 0)
            {
                foreach (var item in SortRules.Select((value, i) => new { i, value }))
                {
                    SortItems e     = item.value;
                    int       Index = item.i;
                    if (e.field == "HotelName")
                    {
                        condition.FilterRules[Index].field = "H.Name";
                    }
                    else
                    {
                        condition.FilterRules[Index].field = "R." + e.field;
                    }
                }
            }

            var req = roomDAL.GetPaging(condition);

            if (req.Succeeded)
            {
                return(Ok(req));
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, req));
            }
        }