public void AddMenus(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{\"status\":\"1\"}"; MenuInfo menu = new MenuInfo { Content = context.Request["Content"].Trim(), Name = context.Request["Name"].Trim() }; if (context.Request["ParentMenuId"] != null) { menu.ParentMenuId = (context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]); } else { menu.ParentMenuId = 0; } menu.Type = context.Request["Type"]; if (WeiboHelper.CanAddMenu(menu.ParentMenuId)) { if (WeiboHelper.SaveMenu(menu)) { s = "{\"status\":\"0\"}"; } } else { s = "{\"status\":\"2\"}"; } context.Response.Write(s); }