//是否收藏 private HpartyForDetail IsFavorite(HpartyForDetail goodinfo, int count_id) { try { goodinfo.favorite = (entity.hp_favorite.First(o => o.goodid == goodinfo.id && o.countid == count_id).state).ToString(); } catch (Exception e) { } return goodinfo; }
public string GetInfoByIdFromHparty(int id,string countid_str) { string jsonstr = ""; try { var model = entity.hp_goodinfo.First(o => o.id == id ); HpartyForDetail goodinfo = new HpartyForDetail(model); if (countid_str!=""&&countid_str!=null) { int countid = Convert.ToInt32(countid_str); goodinfo=IsFavorite(goodinfo,countid); } jsonstr = ReturnJson.toJson("100", "成功", goodinfo); } catch (Exception e) { jsonstr = ReturnJson.toJson("101", "失败", -1); } return jsonstr; }