예제 #1
0
        public async Task <IdentityAdto> GetAsync(GetIdentityAdto getIdentityAdto)
        {
            using (ITransaction transaction = _transactionManager.Create())
            {
                Identity identity = await _identityQueryRepository.GetByIdAsync(getIdentityAdto.Id);

                if (identity == null)
                {
                    throw new BusinessApplicationException(ExceptionType.NotFound, "Identity does not exist");
                }

                transaction.Commit();

                if (identity.HasPassword)
                {
                    return(new PasswordIdentityAdto
                    {
                        Id = identity.Id,
                        Version = ConcurrencyVersionFactory.CreateFromEntity(identity)
                    });
                }

                return(new IdentityAdto
                {
                    Id = identity.Id,
                    Version = ConcurrencyVersionFactory.CreateFromEntity(identity)
                });
            }
        }
 public Task <IdentityAdto> GetAsync(GetIdentityAdto getIdentityAdto)
 {
     return(_securityApplicationService.SecureAsync(() => _identityApplicationService.GetAsync(getIdentityAdto),
                                                    IdentityAuthorisationContext.Create(getIdentityAdto.Id, AuthorisationAction.Get)));
 }