Exemple #1
0
        public async Task <IActionResult> UpdateStock(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "put", Route = null)]
            HttpRequestMessage req, ILogger log)
        {
            string jsonContent = await req.Content.ReadAsStringAsync();

            if (string.IsNullOrEmpty(jsonContent))
            {
                return(new BadRequestErrorMessageResult("Invalid input."));
            }

            CartItem cartItem = JsonConvert.DeserializeObject <CartItem>(jsonContent);

            return(new OkObjectResult(await _checkoutService.UpdateStock(cartItem)));
        }