Exemplo n.º 1
0
        public ActionResult SiteCMSBlockEdit()
        {
            string b_name     = Request["b_name"] ?? string.Empty;
            string b_path     = Request["b_path"] ?? string.Empty;
            string p_gid      = Request["p_gid"] ?? string.Empty;
            string b_gid      = Request["b_gid"] ?? string.Empty;
            string b_img_size = Request["b_img_size"] ?? string.Empty;
            int    siteName   = Request["siteName"].ToInt32(0);

            Site_CMSBlock info = null;

            if (string.IsNullOrEmpty(b_gid))
            {
                info = new Site_CMSBlock();
                //新增
                info.b_gid        = Entity.GenerateGUID();
                info.b_createTime = DateTime.Now;
                info.b_createUser = SiteHelp.CurrentUserName;
                info.b_p_gid      = p_gid;
            }
            else
            {
                info = SiteServiceClass.Site_CMSBlock_SelectByb_gid(b_gid);
            }

            info.b_name     = b_name;
            info.b_path     = b_path;
            info.b_img_size = b_img_size;


            if (string.IsNullOrEmpty(b_gid))
            {
                int result = SiteServiceClass.Site_CMSBlock_Insert(info);
                if (result > 0)
                {
                    return(Json(new { success = true, errors = new { text = "新增成功" } }));
                }
                else
                {
                    return(Json(new { success = false, errors = new { text = "新增失败" } }));
                }
            }
            else
            {
                int result = SiteServiceClass.Site_CMSBlock_UpdateByb_gid(info);
                if (result > 0)
                {
                    return(Json(new { success = true, errors = new { text = "修改成功" } }));
                }
                else
                {
                    return(Json(new { success = false, errors = new { text = "修改失败" } }));
                }
            }
        }