mirror of
https://github.com/ldqk/Masuit.Tools.git
synced 2026-10-18 06:20:42 +08:00
28 lines
568 B
C#
28 lines
568 B
C#
using Masuit.Tools.AspNetCore.ModelBinder;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Net;
|
|
|
|
namespace NetCoreTest.Controllers;
|
|
|
|
[ApiController]
|
|
public class HomeController : Controller
|
|
{
|
|
[HttpPost("test")]
|
|
[ProducesResponseType(typeof(MyClass), (int)HttpStatusCode.OK)]
|
|
public async Task<ActionResult> Test([FromBodyOrDefault] MyClass mc, [FromBodyOrDefault(BindType.Body | BindType.Query)] string name)
|
|
{
|
|
return Ok(new
|
|
{
|
|
name,
|
|
mc
|
|
});
|
|
}
|
|
}
|
|
|
|
public class MyClass
|
|
{
|
|
public string MyProperty { get; set; }
|
|
|
|
public List<string> List { get; set; }
|
|
}
|