Example #1
0
 /// <summary>
 /// 修改权限状态
 /// </summary>
 /// <param name="statusInfo">状态信息</param>
 /// <returns>执行结果</returns>
 public Result ModifyAuthorityStatus(ModifyAuthorityStatusCmdDto statusInfo)
 {
     using (var businessWork = UnitOfWork.Create())
     {
         if (statusInfo == null || statusInfo.AuthorityStatusInfo == null)
         {
             return(Result.FailedResult("没有指定任何要修改的权限信息"));
         }
         List <ModifyAuthorityStatus> modifyStatusList = new List <ModifyAuthorityStatus>();
         foreach (var statusItem in statusInfo.AuthorityStatusInfo)
         {
             modifyStatusList.Add(new ModifyAuthorityStatus()
             {
                 Code   = statusItem.Key,
                 Status = statusItem.Value
             });
         }
         var modifyResult = AuthorityService.ModifyAuthorityStatus(modifyStatusList.ToArray());
         if (!modifyResult.Success)
         {
             return(modifyResult);
         }
         var commitVal = businessWork.Commit();
         return(commitVal.ExecutedSuccess ? Result.SuccessResult("修改成功") : Result.FailedResult("修改失败"));
     }
 }