public JsonResult CreateAndEditer(string DeptId, string DeptName, string ParentId, string Remark) { Dept dept; if (string.IsNullOrEmpty(DeptId)) { dept = new Dept(); } else { dept = db.GetModel(int.Parse(DeptId)); } dept.DeptName = DeptName; if (string.IsNullOrEmpty(ParentId)) { dept.ParentId = null; } else { dept.ParentId = int.Parse(ParentId); } dept.Remark = Remark; dept.LastChangeTime = DateTime.Now; db.Save(dept); return(Json("OK")); }