Exemple #1
0
        public async Task ReplaceAsync(IMerchant merchant)
        {
            var entity = new MerchantEntity(GetPartitionKey(merchant.Name), GetRowKey(merchant.Name));

            Mapper.Map(merchant, entity);

            entity.ETag = "*";

            await _storage.ReplaceAsync(entity);
        }
Exemple #2
0
        public async Task <IMerchant> InsertAsync(IMerchant merchant)
        {
            var entity = new MerchantEntity(GetPartitionKey(merchant.Name), GetRowKey(merchant.Name));

            Mapper.Map(merchant, entity);

            try
            {
                await _storage.InsertAsync(entity);
            }
            catch (StorageException ex)
            {
                if (ex.Message == ConflictMessage)
                {
                    throw new DuplicateMerchantNameException(merchant.Name);
                }

                throw;
            }

            return(entity);
        }