public ActionResult EditOperationGroup(OperationGroupViewModel operationGroup)
 {
     if (IsPost)
     {
         SaveOperationGroupDto saveInfo = new SaveOperationGroupDto()
         {
             OperationGroup = operationGroup.MapTo <OperationGroupDto>()
         };
         var saveResult = operationGroupAppService.SaveOperationGroup(saveInfo);
         var ajaxResult = AjaxResult.CopyFromResult(saveResult);
         ajaxResult.Data         = saveResult.Data?.MapTo <OperationGroupViewModel>();
         ajaxResult.SuccessClose = true;
         return(Json(ajaxResult));
     }
     else if (operationGroup.Id > 0)
     {
         OperationGroupFilterDto filter = new OperationGroupFilterDto()
         {
             Ids = new List <long>()
             {
                 operationGroup.Id
             }
         };
         operationGroup = operationGroupAppService.GetOperationGroup(filter).MapTo <OperationGroupViewModel>();
     }
     return(View(operationGroup));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存操作分组
        /// </summary>
        /// <param name="saveInfo">操作分组保存信息</param>
        /// <returns>返回执行结果</returns>
        public Result <OperationGroupDto> SaveOperationGroup(SaveOperationGroupDto saveOperationGroupDto)
        {
            if (saveOperationGroupDto?.OperationGroup == null)
            {
                return(Result <OperationGroupDto> .FailedResult("没有指定要保存的操作分组信息"));
            }
            using (var businessWork = WorkManager.Create())
            {
                var saveResult = operationGroupService.Save(saveOperationGroupDto.OperationGroup.MapTo <OperationGroup>());
                if (!saveResult.Success)
                {
                    return(Result <OperationGroupDto> .FailedResult(saveResult.Message));
                }

                var commitResult = businessWork.Commit();
                Result <OperationGroupDto> result = null;
                if (commitResult.EmptyResultOrSuccess)
                {
                    result = Result <OperationGroupDto> .SuccessResult("保存成功");

                    result.Data = saveResult.Data.MapTo <OperationGroupDto>();
                }
                else
                {
                    result = Result <OperationGroupDto> .FailedResult("保存失败");
                }
                return(result);
            }
        }
 /// <summary>
 /// 保存授权操作组
 /// </summary>
 /// <param name="saveOperationGroupDto">操作分组保存信息</param>
 /// <returns>返回保存执行结果</returns>
 public Result <OperationGroupDto> SaveOperationGroup(SaveOperationGroupDto saveOperationGroupDto)
 {
     return(operationGroupBusiness.SaveOperationGroup(saveOperationGroupDto));
 }