Skip to content

Instantly share code, notes, and snippets.

@karthikeyanVK
Created February 14, 2020 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthikeyanVK/f28df808dd0f8a04eec6f041ad6de7fe to your computer and use it in GitHub Desktop.
Save karthikeyanVK/f28df808dd0f8a04eec6f041ad6de7fe to your computer and use it in GitHub Desktop.
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using PetShop.Business;
using PetShop.Model;
namespace PetShop.Products
{
public static class UpdateProductQuantity
{
[FunctionName("UpdateProductQuantity")]
public static bool Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string requestBody = new StreamReader(req.Body).ReadToEnd();
log.LogInformation("Input:" + requestBody);
OrderedProduct orderedProduct = JsonConvert.DeserializeObject<OrderedProduct>(requestBody);
var productService = new ProductService();
return productService.UpdateProductQuantity(orderedProduct);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment