Ejemplo n.º 1
0
 public ActionResult SSOPoolAdd(SSOPoolAddModel addModel)
 {
     ISSOPoolService service = new SSOPoolService();
     var jsonModel = service.AddSSOPool(addModel);
     if (jsonModel.Success)
     {
         return Json(new { success = true, msg = "添加成功" }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new { success = false, msg = jsonModel.ErrMsg }, JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加一个单点登录池
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public JsonModel<string> AddSSOPool(SSOPoolAddModel model)
 {
     JsonModel<string> jsonModel = new JsonModel<string>()
     {
         Success = false,
         SuccessMsg = "添加成功",
         ErrMsg = "添加失败"
     };
     //对实体进行验证
     var validate = DotNet.Utils.DataValidate.ValidateHelper<SSOPoolAddModel>.ValidateModel(model);
     if (!validate.Pass)
     {
         jsonModel.ErrMsg = validate.ResultList.FirstOrDefault().ErrorMessage;
         return jsonModel;
     }
     //字符过滤
     model.ReMark = DotNet.Utils.Untility.StringHelper.FilterHtml(model.ReMark);
     //判断主域是否存在
     IDomainDal domainDal = new DomainDal();
     if (model.MainDomainId > 0)
     {
         var domain = domainDal.GetEntity(model.MainDomainId);
         if (domain == null)
         {
             jsonModel.ErrMsg = "主域不存在";
             return jsonModel;
         }
     }
     //构建实体
     SSOPool pool = new SSOPool()
     {
         PoolName = model.PoolName,
         IsEnabled = model.IsEnabled,
         MaxAmount = model.MaxAmount,
         MainDomainId = model.MainDomainId,
         DelFlag = (int)DelFlagEnum.Noraml,
         ReMark = model.ReMark
     };
     ISSOPoolDal ssoPoolDal = new SSOPoolDal();
     var r = ssoPoolDal.AddEntity(pool);
     if (r != null)
     {
         jsonModel.Success = true;
     }
     return jsonModel;
 }