public ActionResult SaveValueItem(string json) { var svc = new ValueSetService(); if (string.IsNullOrWhiteSpace(json)) { return(Json(new { State = false, Msg = "保存的内容为空。" }, JsonRequestBehavior.AllowGet)); } var v = Newtonsoft.Json.JsonConvert.DeserializeObject <ValueItem>(json); try { svc.SaveValueItem(v); } catch (Exception e) { return(Json(new { State = false, Msg = e.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { State = true, Msg = "", Data = v }, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateValueItem(string json) { try { var vi = Newtonsoft.Json.JsonConvert.DeserializeObject <ValueItem>(json); var svc = new ValueSetService(); svc.SaveValueItem(vi); return(Json(new { State = false, Msg = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(new { State = false, Msg = e.Message }, JsonRequestBehavior.AllowGet)); } }