Beispiel #1
0
        public ActionResult SaveWebSiteGroup(FormCollection form)
        {
            var        msg    = string.Empty;
            var        id     = form["id"];
            var        name   = form["txtGroupName"];
            var        count  = form["txtCount"];
            var        pareId = form["pareId"] == null?"0" : form["pareId"];
            JsonResult json   = new JsonResult();

            if (id == "")
            {
                var rows = WebsiteBLL.GetWebsiteGroupByName(name);
                if (!"0".Equals(rows))
                {
                    msg = "该网站分组已经存在";
                    return(JavaScript("alert('" + msg + "')"));
                }
                else
                {
                    var row = WebsiteBLL.AddWebsiteGroup(name, pareId, Session["LoginUser"].ToString(), count);
                    if (row > 0)
                    {
                        json.Data = new
                        {
                            result = "true"
                        };
                    }
                }
            }
            else
            {
                var row = WebsiteBLL.UpDateWebsiteGroup(name, id, count);
                if (row > 0)
                {
                    json.Data = new
                    {
                        result = "true"
                    };
                }
            }
            return(json);
        }