示例#1
0
        public ActionResult AddExpress()
        {
            if (Request.HttpMethod != "POST")
            {
                if (!AppData.IsManagerLogin)
                {
                    return(Redirect("/Manage/Error/1.html"));
                }
                if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1201))
                {
                    return(Redirect("/Manage/Error/2.html"));
                }

                return(View());
            }
            else
            {
                if (!AppData.IsManagerLogin)
                {
                    return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
                }
                if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1201))
                {
                    return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
                }

                ExpressBLL expressBLL = new ExpressBLL();

                Validation vld        = new Validation();
                ExpressObj expressObj = new ExpressObj();
                expressObj.ExpressName = vld.Get("name", false);
                expressObj.ExpressUrl  = vld.Get("url");

                if (vld.HasError)
                {
                    return(Json(new { success = false, msg = "必须填写快递名称" }));
                }

                expressBLL.AddExpress(expressObj);

                return(Json(new { success = true }));
            }
        }