public Newtonsoft.Json.Linq.JArray processer(string jsonStr) { String userID = null; String pTypeID = null; String attribute = null; String authorID = null; String writeTime = null; JArray jsa = JArray.Parse(jsonStr); JObject json = JObject.Parse(jsa[0].ToString()); userID = json["userID"].ToString(); pTypeID = json["pTypeID"].ToString(); attribute = json["attribute"].ToString(); ProductDao pd = new ProductDao(); ProductModel m = new ProductModel(pTypeID, attribute, authorID, writeTime); // pd.addModel(m); String result = pd.addModel(m, userID) == -1 ? "false" : "true"; JArray jsaa = new JArray(); JObject jsn = new JObject(); jsn.Add("isOk", result); jsaa.Add(jsn); return jsaa; }
public Newtonsoft.Json.Linq.JArray processer(string jsonStr) { String userID = null; JArray jsa = JArray.Parse(jsonStr); JObject json = JObject.Parse(jsa[0].ToString()); userID = json["userID"].ToString(); List<Model> ms = new ProductDao().getBigType(userID); JArray ja = new JArray(); foreach (Model m in ms) { JObject js = new JObject(); js = new ProductRowMapper().mappingRow(m); ja.Add(js); } return ja; }