示例#1
0
        public async Task <HeroDocument> UpdateByIdAsync(
            Guid id,
            HeroDocument heroDocument)
        {
            var heroContainer =
                _cosmosDatabase.Containers[_containerId];

            var heroDocumentResponse =
                await heroContainer.Items.ReplaceItemAsync <HeroDocument>(
                    id.ToString(),
                    id.ToString(),
                    heroDocument);

            return(heroDocumentResponse.Resource);
        }
示例#2
0
        public async Task <HeroDocument> AddAsync(
            HeroDocument heroDocument)
        {
            var heroContainer =
                _cosmosDatabase.Containers[_containerId];

            heroDocument.HeroId =
                heroDocument.Id;

            var heroDocumentResponse =
                await heroContainer.Items.CreateItemAsync(
                    heroDocument.Id.ToString(),
                    heroDocument);

            return(heroDocumentResponse.Resource);
        }