コード例 #1
0
        public async Task <bool> UpdateProductAsync(Product product)
        {
            var productCosmos = new CosmosProduct
            {
                ProductID   = product.ProductID.ToString(),
                ProductName = product.ProductName,
                ProductCode = product.ProductCode
            };

            var response = await _cosmosStore.UpdateAsync(productCosmos);

            return(response.IsSuccess);
        }
コード例 #2
0
        public async Task <bool> CreateProductAsync(Product product)
        {
            var productCosmos = new CosmosProduct
            {
                ProductID   = Guid.NewGuid().ToString(),
                ProductName = product.ProductName,
                ProductCode = product.ProductCode
            };

            var response = await _cosmosStore.AddAsync(productCosmos);

            product.ProductID = Guid.Parse(productCosmos.ProductID);

            return(response.IsSuccess);
        }