Exemplo n.º 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <JsonResponse> Remove(EntityRequest input)
        {
            input.InitModifyRequest();
            var resJson = await _applicationEnginee.TryTransactionAsync(async() =>
            {
                await _roleMenuAppService.RemoveAsync(input);
            });

            return(resJson);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <JsonResponse> RemoveRole(EntityRequest input)
        {
            var exitsMap = await _relationEmployeeRoleApp.GetAnyByRoleIdAsync(input.Id);

            if (exitsMap)
            {
                return(JsonResponse.Create(false, "该角色下有成员"));
            }
            input.Ids = new List <string>()
            {
                input.Id
            };
            var roleMenuIds = await _roleMenuAppService.GetIdsByRoleIdsAsync(new List <string>() { input.Id });

            var roleElementIds = await _roleElementAppService.GetIdsByRoleIdsAsync(new List <string>() { input.Id });

            var resJson = await _applicationEnginee.TryTransactionAsync(async() =>
            {
                await _roleAppService.RemoveAsync(input);
                await _roleMenuAppService.RemoveAsync(new EntityRequest()
                {
                    Ids            = roleMenuIds,
                    ModifyDate     = DateTime.Now,
                    ModifyUserId   = input.ModifyUserId,
                    ModifyUserName = input.ModifyUserName
                });
                await _roleElementAppService.RemoveAsync(new EntityRequest()
                {
                    Ids            = roleElementIds,
                    ModifyDate     = DateTime.Now,
                    ModifyUserId   = input.ModifyUserId,
                    ModifyUserName = input.ModifyUserName
                });
            });

            return(resJson);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <JsonResponse> RemoveMenu(EntityRequest input)
        {
            var orgMenuIds = await _organizationMenuAppService.GetIdsByMenuIdsAsync(input.Ids);

            var roleMenuIds = await _roleMenuAppService.GetIdsByMenuIdsAsync(input.Ids);

            var empMenuIds = await _employeeMenuAppService.GetIdsByMenuIdsAsync(input.Ids);

            var resJson = await _applicationEnginee.TryTransactionAsync(async() =>
            {
                await _menuAppService.RemoveAsync(input);
                await _organizationMenuAppService.RemoveAsync(new EntityRequest()
                {
                    Ids            = orgMenuIds,
                    ModifyDate     = DateTime.Now,
                    ModifyUserId   = input.ModifyUserId,
                    ModifyUserName = input.ModifyUserName
                });
                await _roleMenuAppService.RemoveAsync(new EntityRequest()
                {
                    Ids            = roleMenuIds,
                    ModifyDate     = DateTime.Now,
                    ModifyUserId   = input.ModifyUserId,
                    ModifyUserName = input.ModifyUserName
                });
                await _employeeMenuAppService.RemoveAsync(new EntityRequest()
                {
                    Ids            = empMenuIds,
                    ModifyDate     = DateTime.Now,
                    ModifyUserId   = input.ModifyUserId,
                    ModifyUserName = input.ModifyUserName
                });
            });

            return(resJson);
        }