public static string Insert(string temp) { JObject jo = (JObject)JsonConvert.DeserializeObject(temp); string msg; Models.Storeroom storeroom = new Models.Storeroom(jo["name"].ToString(), jo["site"].ToString(), ""); return(StoreManage.Add(storeroom, out msg) ? JsonConvert.SerializeObject(new Packet(200, "插入成功")) : JsonConvert.SerializeObject(new Packet(203, msg))); }
public static string Update(string temp) { JObject jo = (JObject)JsonConvert.DeserializeObject(temp); string msg; Models.Storeroom storeroom = new Models.Storeroom((int)jo["id"], jo["name"].ToString(), jo["site"].ToString(), ""); return(StoreManage.Update(storeroom, out msg) ? JsonConvert.SerializeObject(new Packet(200, "修改成功")) : JsonConvert.SerializeObject(new Packet(202, msg))); }