コード例 #1
0
        public async Task UpdateRoleAsync(RoleEditDto input)
        {
            var info = await _roleManage.GetRoleByIdAsync(input.Id);

            input.MapTo(info);
            await _roleManage.UpdateRoleAsync(info);
        }
コード例 #2
0
ファイル: RoleAppService.cs プロジェクト: andyshao/ABP-1
        public async Task Update(RoleEditDto input)
        {
            var rs = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);
            if (rs == null)
            {
                throw new UserFriendlyException(string.Format("There is no role with id : {0}", input.Id));
            }

            input.MapTo(rs);

            var result = await _repository.FirstOrDefaultAsync(x => x.RoleCode == input.RoleCode);

            if (result != null && result.Id != input.Id)
            {
                throw new UserFriendlyException(string.Format(L("DuplicateRoleCode"), input.RoleCode));
            }

            await _repository.UpdateAsync(rs);
        }
コード例 #3
0
ファイル: RoleAppService.cs プロジェクト: nozerowu/ABP
        public async Task Update(RoleEditDto input)
        {
            var rs = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id);

            if (rs == null)
            {
                throw new UserFriendlyException(string.Format("There is no role with id : {0}", input.Id));
            }

            input.MapTo(rs);

            var result = await _repository.FirstOrDefaultAsync(x => x.RoleCode == input.RoleCode);

            if (result != null && result.Id != input.Id)
            {
                throw new UserFriendlyException(string.Format(L("DuplicateRoleCode"), input.RoleCode));
            }

            await _repository.UpdateAsync(rs);
        }
コード例 #4
0
 public async Task CreateRoleAsync(RoleEditDto input)
 {
     var info = input.MapTo <Role>();
     await _roleManage.CreateRoleAsync(info);
 }