diff --git a/daprdocs/content/en/developing-applications/building-blocks/bindings/howto-triggers.md b/daprdocs/content/en/developing-applications/building-blocks/bindings/howto-triggers.md index 4a5f6d4dd..6af2a1027 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/bindings/howto-triggers.md +++ b/daprdocs/content/en/developing-applications/building-blocks/bindings/howto-triggers.md @@ -119,6 +119,8 @@ Below are code examples that leverage Dapr SDKs to demonstrate an output binding {{% codetab %}} +The following example demonstrates how to configure an input binding using ASP.NET Core controllers. + ```csharp //dependencies using System.Collections.Generic; @@ -126,21 +128,27 @@ using System.Threading.Tasks; using System; using Microsoft.AspNetCore.Mvc; -//code -namespace CheckoutService.controller +namespace CheckoutService.controller; + +[ApiController] +public sealed class CheckoutServiceController : ControllerBase { - [ApiController] - public class CheckoutServiceController : Controller + [HttpPost("/checkout")] + public ActionResult getCheckout([FromBody] int orderId) { - [HttpPost("/checkout")] - public ActionResult getCheckout([FromBody] int orderId) - { - Console.WriteLine("Received Message: " + orderId); - return "CID" + orderId; - } + Console.WriteLine($"Received Message: {orderId}"); + return $"CID{orderId}"; } } +``` +The following example demonstrates how to configure the same input binding using a minimal API approach: +```csharp +app.MapPost("checkout", ([FromBody] int orderId) => +{ + Console.WriteLine($"Received Message: {orderId}"); + return $"CID{orderId}" +}); ``` {{% /codetab %}}