Skip to content

Commit

Permalink
add input binding processing controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Yongguang Zhu committed Nov 2, 2022
1 parent c452222 commit 6c84249
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions BindingsWithSdk/Controllers/InputController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using BindingsWithSdk.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BindingsWithSdk.Controllers
{
[ApiController]
public class InputController : ControllerBase
{
[HttpPost("/user-input-binding")]
public IActionResult Post([FromBody] User user)
{
Console.WriteLine(user);
return Ok(user);
}
}
}
1 change: 1 addition & 0 deletions BindingsWithSdk/Controllers/OutputController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public async Task<IActionResult> Get()
{
Name = "zyg",
Email = "heavenwing@msn.com",
DisplayName = "朱永光"
};
await daprClient.InvokeBindingAsync("user-output-binding", "create", model);
return Ok(model);
Expand Down
9 changes: 9 additions & 0 deletions BindingsWithSdk/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
{
public class User
{
public Guid? Id { get; set; }

public string Name { get; set; }

public string Email { get; set; }

public string DisplayName { get; set; }

public override string ToString()
{
return $"Id: {Id}, Name: {Name}, Email: {Email}, DisplayName: {DisplayName}";
}
}
}

0 comments on commit 6c84249

Please sign in to comment.