public async Task <IMerchant> InsertAsync(IMerchant merchant) { var existingEmailIndex = await _emailIndexStorage.GetDataAsync( MerchantEntity.IndexByEmail.GeneratePartitionKey(merchant.Email), MerchantEntity.IndexByEmail.GenerateRowKey()); if (existingEmailIndex != null) { throw new DuplicateMerchantEmailException(merchant.Email); } var entity = MerchantEntity.ById.Create(merchant); try { await _storage.InsertThrowConflict(entity); } catch (DuplicateKeyException) { throw new DuplicateMerchantNameException(merchant.Name); } var index = MerchantEntity.IndexByEmail.Create(entity); await _emailIndexStorage.InsertThrowConflict(index); return(entity); }
public async Task <IVolatilitySettings> AddAsync(IVolatilitySettings src) { var entity = VolatilitySettingsEntity.ByMerchant.Create(src); await _storage.InsertThrowConflict(entity); return(Mapper.Map <VolatilitySettings>(entity)); }
public async Task <IMerchantConfigurationLine> AddAsync(IMerchantConfigurationLine src) { MerchantConfigurationLineEntity entity = MerchantConfigurationLineEntity.ByMerchant.Create(src); await _storage.InsertThrowConflict(entity); return(Mapper.Map <MerchantConfigurationLine>(entity)); }
public async Task <ISupervisorMembership> AddAsync(ISupervisorMembership src) { SupervisorMembershipEntity entity = SupervisorMembershipEntity.ByMerchant.Create(src); await _tableStorage.InsertThrowConflict(entity); AzureIndex index = SupervisorMembershipEntity.IndexByEmployee.Create(entity); await _employeeIndexStorage.InsertThrowConflict(index); return(Mapper.Map <Core.Domain.SupervisorMembership.SupervisorMembership>(entity)); }
public async Task <Core.Domain.ResetPasswordAccessToken> CreateAsync(Core.Domain.ResetPasswordAccessToken token) { ResetPasswordAccessTokenEntity entity = ResetPasswordAccessTokenEntity.ByEmployeeId.Create(token); await _storage.InsertThrowConflict(entity); AzureIndex index = ResetPasswordAccessTokenEntity.IndexByPublicId.Create(entity); await _indexByPublicIdStorage.InsertThrowConflict(index); return(Mapper.Map <Core.Domain.ResetPasswordAccessToken>(entity)); }
public async Task <IMerchantGroup> CreateAsync(IMerchantGroup src) { MerchantGroupEntity entity = MerchantGroupEntity.ByOwner.Create(src); await _tableStorage.InsertThrowConflict(entity); AzureIndex index = MerchantGroupEntity.IndexById.Create(entity); await _groupIndexStorage.InsertThrowConflict(index); return(Mapper.Map <MerchantGroup>(entity)); }
public Task AddAsync(IRegulation regulation) { return(_tableStorage.InsertThrowConflict(Create(regulation.Id))); }
public Task AddAsync(IClientRegulation clientRegulation) { return(_tableStorage.InsertThrowConflict(Create(clientRegulation))); }