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
environment: development | |
apphost: k8s | |
products: | |
label: | |
name: aspnet3core | |
container: | |
name: aspnet3 |
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
name: aspnet3-demo | |
version: 1.0.0 |
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
{ | |
"IsEncrypted": false, | |
"Values": { | |
"AzureWebJobsStorage": "UseDevelopmentStorage=true", | |
"FUNCTIONS_WORKER_RUNTIME": "dotnet", | |
"DatabaseName": "petshopapps", | |
"ContainerName": "orders", | |
"Account": "https://petshopapps.documents.azure.com:443/", | |
"CosmosKey": "sBlINeLXdn9PLk157Zu3PGMQ7hljAvZF02LOYrjLdqJO5GTHhro79WlxsGPXQT7GF4KptfJnsnqhjDaKZgRHXA==", | |
"ProductBaseUrl": "http://localhost:7071/api/UpdateProductQuantity" |
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; | |
namespace PetShop.Model | |
{ | |
public class OrderedProduct | |
{ | |
public Guid ProductId; | |
public int OrderedProductQuantity { get; set; } | |
} | |
} |
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
{ | |
"ProductName":"Dog1", | |
"CustomerId":"17EDCACA-C902-431A-B935-A1FCF05CA52A", | |
"ProductId":"17EDCACb-C902-431A-B935-A1FCF05CA52A", | |
"OrderedProductQuantity":"20" | |
} |
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; | |
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
public bool UpdateProductQuantity(OrderedProduct orderedProduct) | |
{ | |
using (var context = new PetShopContext()) | |
{ | |
var productFromDb = context.Products.Find(orderedProduct.ProductId); | |
productFromDb.Quantity -= orderedProduct.OrderedProductQuantity; | |
context.SaveChanges(); | |
} |
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; | |
using Newtonsoft.Json; | |
namespace PetShop.Model | |
{ | |
public class Order | |
{ | |
[JsonProperty(PropertyName = "id")] | |
public Guid OrderId { get; set; } | |
public Guid CustomerId { get; set; } |
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; | |
using PetShop.DBAccess.CosmosDB; | |
using PetShop.Model; | |
using PetShop.DBAccess.CosmosDB; | |
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using Newtonsoft.Json; | |
using System.Text; |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.Cosmos; | |
using Microsoft.Azure.Cosmos.Fluent; | |
namespace PetShop.DBAccess.CosmosDB | |
{ |