public async Task <FacebookAdto> CreateAsync(CreateFacebookAdto createFacebookAdto)
        {
            using (ITransaction transaction = _transactionManager.Create())
            {
                try
                {
                    AuthenticationGrantTypeFacebook authenticationGrantTypeFacebook =
                        await _createAuthenticationGrantTypeFacebookCommand.ExecuteAsync(
                            _mapper.Map <CreateFacebookAdto, CreateAuthenticationGrantTypeFacebookDdto>(createFacebookAdto));

                    await _commandRepository.AddAsync(authenticationGrantTypeFacebook);

                    transaction.Commit();

                    return(CreateFacebookAdto(authenticationGrantTypeFacebook));
                }
                catch (DomainValidationRuleException e)
                {
                    throw new BusinessValidationRuleApplicationException(e.ValidationResult);
                }
            }
        }
Beispiel #2
0
 public Task <FacebookAdto> CreateAsync(CreateFacebookAdto createFacebookAdto)
 {
     return(_securityApplicationService.SecureAsync(() => _facebookAuthenticationServiceApplicationService.CreateAsync(createFacebookAdto),
                                                    DefaultAuthorisationContext.Create(AuthorisationResource.AuthenticationService, AuthorisationAction.Create)));
 }