public ActionResult toAdd(PDA p) { if (string.IsNullOrWhiteSpace(p.Keys)) { return(Content("序列号不能为空")); } if (PDA.GetIsByKeys(p.Keys) != null) { return(Content("序列号已经存在,请检查后再试!")); } p.CreateTime = CommonFunc.GetNowTimestamp(); p.State = p.State == "on" ? "启用" : "禁用"; int rtn = p.InsertAndReturnIdentity(); return(Content(rtn > 0 ? "ok" : "添加出错了!!")); }