예제 #1
0
        public async Task <IActionResult> UpdateActions(string id, [FromBody] ProductPromoAction productPromoAction)
        {
            ProductPromo promo = await _adapter.GetDataById("PromoDatabase", "PromoCollection", id);

            var productPromoActionInstance = promo.actions;



            if (productPromoActionInstance != null)
            {
                productPromoActionInstance.type      = productPromoAction.type;
                productPromoActionInstance.quantity  = productPromoAction.quantity;
                productPromoActionInstance.amount    = productPromoAction.amount;
                productPromoActionInstance.productId = productPromoAction.productId;
                productPromoActionInstance.catalogId = productPromoAction.catalogId;
            }
            else
            {
                return(NotFound());
            }
            var result = await _adapter.UpdateActionDocumentAsync("PromoDatabase", "PromoCollection", promo);

            return(Ok(result));
        }