Example #1
0
 public IActionResult GetUserCollectionHouses(string cityName, string source = "")
 {
     try
     {
         var userID = GetUserID();
         if (userID == 0)
         {
             return(Json(new { IsSuccess = false, error = "用户未登陆,无法查看房源收藏。" }));
         }
         var houseList = userCollectionDapper.FindUserCollections(userID, cityName, source);
         var rooms     = houseList.Select(house =>
         {
             return(new HouseInfo
             {
                 ID = house.Id,
                 Source = house.Source,
                 Money = house.DisPlayPrice,
                 HouseURL = house.HouseOnlineURL,
                 HouseLocation = house.HouseLocation,
                 HouseTime = house.PubTime.ToString(),
                 HouseTitle = house.HouseTitle,
                 HousePrice = (int)house.HousePrice
             });
         });
         return(Json(new { IsSuccess = true, HouseInfos = rooms }));
     }
     catch (Exception ex)
     {
         return(Json(new { IsSuccess = false, error = ex.ToString() }));
     }
 }
 public IActionResult GetUserCollectionHouses(string cityName, string source = "")
 {
     try
     {
         var userID = GetUserID();
         if (userID == 0)
         {
             return(Json(new { IsSuccess = false, error = "用户未登陆,无法查看房源收藏。" }));
         }
         var rooms = _userCollectionDapper.FindUserCollections(userID, cityName, source);
         return(Json(new { IsSuccess = true, HouseInfos = rooms }));
     }
     catch (Exception ex)
     {
         return(Json(new { IsSuccess = false, error = ex.ToString() }));
     }
 }
 public IActionResult List(long userId, [FromHeader] string token, string cityName, string source = "")
 {
     try
     {
         var userInfo = userService.GetUserInfo(userId, token);
         if (userInfo == null)
         {
             return(Ok(new { IsSuccess = false, error = "用户未登陆,无法进行操作。" }));
         }
         var rooms = userCollectionDapper.FindUserCollections(userId, cityName, source);
         return(Ok(new { success = true, data = rooms }));
     }
     catch (Exception ex)
     {
         return(Ok(new { IsSuccess = false, error = ex.ToString() }));
     }
 }
Example #4
0
        public IActionResult UserHouseList()
        {
            var userHouses = new List <DBHouseInfo>();
            var userID     = GetUserID();

            if (userID == 0)
            {
                return(PartialView("UserHouseList", userHouses));
            }
            userHouses = UserCollectionDapper.FindUserCollections(userID);
            return(PartialView("UserHouseList", userHouses));
        }
Example #5
0
 public IActionResult GetUserCollectionHouses(string cityName, string source = "")
 {
     try
     {
         var userID = GetUserID();
         if (userID == 0)
         {
             return(Json(new { IsSuccess = false, error = "用户未登陆,无法查看房源收藏。" }));
         }
         var houseList = userCollectionDapper.FindUserCollections(userID, cityName, source);
         var rooms     = houseList.Select(house =>
         {
             var markBGType = string.Empty;
             int housePrice = (int)house.HousePrice;
             if (housePrice > 0)
             {
                 markBGType = LocationMarkBGType.SelectColor(housePrice / 1000);
             }
             return(new HouseInfo
             {
                 ID = house.Id,
                 Source = house.Source,
                 Money = house.DisPlayPrice,
                 HouseURL = house.HouseOnlineURL,
                 HouseLocation = house.HouseLocation,
                 HouseTime = house.PubTime.ToString(),
                 HouseTitle = house.HouseTitle,
                 HousePrice = housePrice,
                 LocationMarkBG = markBGType,
                 DisplaySource = ConstConfigurationName.ConvertToDisPlayName(house.Source)
             });
         });
         return(Json(new { IsSuccess = true, HouseInfos = rooms }));
     }
     catch (Exception ex)
     {
         return(Json(new { IsSuccess = false, error = ex.ToString() }));
     }
 }
 public List <HouseInfo> FindUserCollections(long userId, string cityName = "", string source = "")
 {
     return(_dapper.FindUserCollections(userId, cityName, source));
 }