コード例 #1
0
        /// <inheritdoc/>
        public async Task <object> CreateProductAsync <TInput, TType>(TInput input, TType options = default(TType))
        {
            if (input is HttpRequestMessage req)
            {
                dynamic body = await req.Content.ReadAsStringAsync();

                var productEntity = JsonConvert.DeserializeObject <ProductEntity>(body as string);

                productEntity.PartitionKey = productEntity.Category.ToEnum <ProductCategory>().ToString();
                productEntity.RowKey       = Guid.NewGuid().ToString();

                productEntity = (ProductEntity)await AzureUtils.InsertOrMergeEntityAsync(_table, productEntity);

                return(productEntity);
            }
            else
            {
                return(null);
            }
        }