View Suborchestrator.cs
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
[FunctionName("DynamicOrchestrator")] | |
public static async Task<DynamicResult<int>> RunInnerOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext ctx) | |
{ | |
var input = ctx.GetInput<DynamicFlowContext>(); | |
int state = 0; | |
foreach (var step in input.Steps) | |
{ | |
state = await ctx.CallActivityAsync<int>(step.Action, (state, step.param)); | |
} |
View FlowMaker-LowCode.cs
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
namespace dynamicworkflows.Workflows | |
{ | |
using Jint; | |
using Newtonsoft.Json; | |
using System.Collections.Generic; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.DurableTask; | |
using Microsoft.Azure.WebJobs.Extensions.Http; |
View DynamicOrchestrator.cs
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 static class FlowMaker | |
{ | |
[FunctionName("FlowMaker")] | |
public static async Task<int> Run([OrchestrationTrigger] IDurableOrchestrationContext context) | |
{ | |
// imagine this comes from a DB or the request payload | |
var steps = new DynamicFlowContext | |
{ | |
Steps = new List<DynamicStep<int>> |
View solution2.cs
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
class Solution | |
{ | |
static void Main() | |
{ | |
int L = int.Parse(Console.ReadLine()); | |
int H = int.Parse(Console.ReadLine()); | |
string Sentence = Console.ReadLine().ToUpper(); | |
for (int i = 0; i < H; i++) { | |
string AsciiRow = Console.ReadLine(); |
View solution.cs
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
class Solution | |
{ | |
static void Main(string[] args) | |
{ | |
int L = int.Parse(Console.ReadLine()); | |
int H = int.Parse(Console.ReadLine()); | |
var writter = new Writer(H,L); | |
string T = Console.ReadLine(); |
View GetCartForSession.cs
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
[FunctionName("GetCartForSession")] | |
public static async Task<IActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "cart/{id}")] HttpRequestMessage req, | |
Guid id, | |
[DurableClient] IDurableClient client, | |
ILogger log) | |
{ | |
if (id == Guid.Empty) | |
{ | |
return (ActionResult) new BadRequestObjectResult("The ID is required"); |
View RemoveItemFromCartActivity.cs
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
[FunctionName("RemoveItemFromCart")] | |
public static async Task<IActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "cart/{id}/remove")] HttpRequestMessage req, | |
Guid id, | |
[DurableClient] IDurableClient client, ILogger log) | |
{ | |
if (id == Guid.Empty) | |
{ | |
return (ActionResult) new BadRequestObjectResult("Id is required"); |
View CartItem.cs
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 class CartItem | |
{ | |
public Guid ProductId { get; set; } | |
public int Count { get; set; } | |
} |
View AddItemToCartTrigger.cs
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
[FunctionName("AddItemToCart")] | |
public static async Task<ActionResult> RunAsync( | |
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "cart/{id}/add")] HttpRequestMessage req, | |
Guid id, | |
[DurableClient] IDurableEntityClient client ) | |
{ | |
if (id == Guid.Empty) | |
{ | |
return (ActionResult) new BadRequestObjectResult("Id is required"); | |
} |
View ShoppingCartEntity.cs
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
[JsonObject(MemberSerialization.OptIn)] | |
public class ShoppingCartEntity : IShoppingCart | |
{ | |
[JsonProperty("list")] | |
private List<CartItem> list { get; set; } = new List<CartItem>(); | |
public void Add(CartItem item) | |
{ | |
// Get existing |
NewerOlder