Created
February 14, 2020 08:58
-
-
Save karthikeyanVK/f28df808dd0f8a04eec6f041ad6de7fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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