示例#1
0
        public IActionResult GetHouseInfo(string cityName, string source = "", int houseCount = 100,
                                          int withAnyDays = 3, bool showDoubanInvalidData     = true, string keyword = "")
        {
            try
            {
                var lstHouseInfo = new DBHouseInfoDAL().SearchHouseInfo(cityName, source, houseCount, withAnyDays, showDoubanInvalidData, keyword);
                var lstRoomInfo  = lstHouseInfo.Select(house =>
                {
                    var markBGType = string.Empty;
                    int housePrice = (int)house.HousePrice;
                    if (housePrice > 0)
                    {
                        markBGType = LocationMarkBGType.SelectColor(housePrice / 1000);
                    }

                    return(new HouseInfo
                    {
                        Money = house.DisPlayPrice,
                        HouseURL = house.HouseOnlineURL,
                        HouseLocation = house.HouseLocation,
                        HouseTime = house.PubTime.ToString(),
                        HousePrice = housePrice,
                        LocationMarkBG = markBGType,
                        DisplaySource = ConstConfigurationName.ConvertToDisPlayName(house.Source)
                    });
                });
                return(Json(new { IsSuccess = true, HouseInfos = lstRoomInfo }));
            }catch (Exception ex)
            {
                return(Json(new { IsSuccess = false, error = ex.ToString() }));
            }
        }
        public IActionResult GetHouseInfo(string cityName, string source = "", int houseCount = 400,
                                          int withAnyDays = 3, string keyword = "")
        {
            var houses = new DBHouseInfoDAL().SearchHouseInfo(cityName, source, houseCount, withAnyDays, keyword);

            var lstRoomInfo = houses.Select(house =>
            {
                var markBGType = string.Empty;
                int housePrice = (int)house.HousePrice;
                if (housePrice > 0)
                {
                    markBGType = LocationMarkBGType.SelectColor(housePrice / 1000);
                }

                return(new HouseInfo
                {
                    Money = house.DisPlayPrice,
                    HouseURL = house.HouseOnlineURL,
                    HouseLocation = house.HouseLocation,
                    HouseTime = house.PubTime.ToString(CultureInfo.CurrentCulture),
                    HousePrice = housePrice,
                    LocationMarkBG = markBGType,
                    DisplaySource = ConstConfigurationName.ConvertToDisPlayName(house.Source)
                });
            });

            return(Json(new { IsSuccess = true, HouseInfos = lstRoomInfo }));
        }