Exemplo n.º 1
0
        /// <summary>
        /// 添加客户端子系统
        /// </summary>
        /// <param name="name">子系统名字</param>
        /// <returns></returns>
        public ActionResult Add(string name, string domain)
        {
            if (ClientAppBll.Any(a => a.AppName.Equals(name)))
            {
                return(ResultData(null, false, $"{name} 应用已经存在!"));
            }

            string    appid = Guid.NewGuid().ToString().MDString();
            ClientApp app   = new ClientApp()
            {
                AppName = name, Domain = domain, AppId = appid, AppSecret = appid.MDString(ConfigurationManager.AppSettings["BaiduAK"])
            };

            app = ClientAppBll.AddEntitySaved(app);
            if (app != null)
            {
                return(ResultData(app, true, "应用程序添加成功!"));
            }

            return(ResultData(null, false, "应用程序添加失败!"));
        }