示例#1
0
        public async Task <bool> SaveAsync(SampleEntity entity)
        {
            string eTag     = null;
            var    dbEntity = entity as SampleEntityExtension;

            if (dbEntity == null)
            {
                dbEntity = SampleEntityExtension.FromSampleEntity(entity);
            }
            else
            {
                eTag = dbEntity.ETag;
            }

            var result = await repository.SaveAsync(entity.Id.ToString(), entity.OwnerId.ToString(), dbEntity, eTag);

            return(result.IsSuccessful);
        }
示例#2
0
 private async Task <OperationResult> SaveItem(SampleEntity entity, string eTag = null)
 {
     output.WriteLine($"Saving the entity '{entity.Id}' in the repository");
     return(await repository.SaveAsync(entity.Id.ToString(), GetPartitionKey(entity), entity, eTag));
 }