public virtual async Task <ClientDto> CreateAsync(ClientCreateDto clientCreate)
        {
            var clientIdExists = await ClientRepository.CheckClientIdExistAsync(clientCreate.ClientId);

            if (clientIdExists)
            {
                throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ClientIdExisted, clientCreate.ClientId]);
            }
            var client = new Client(GuidGenerator.Create(), clientCreate.ClientId)
            {
                ClientName  = clientCreate.ClientName,
                Description = clientCreate.Description
            };

            foreach (var inputGrantType in clientCreate.AllowedGrantTypes)
            {
                client.AddGrantType(inputGrantType.GrantType);
            }

            client = await ClientRepository.InsertAsync(client);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(ObjectMapper.Map <Client, ClientDto>(client));
        }
Exemplo n.º 2
0
 public virtual async Task <ClientDto> CreateAsync(ClientCreateDto clientCreate)
 {
     return(await ClientAppService.CreateAsync(clientCreate));
 }