Files
HTCloud/HT.Cloud.Web/Controllers/Api/TestController.cs
2023-03-03 16:07:50 +08:00

50 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace HT.Cloud.Web
{
/// <summary>
/// 测试文件
/// </summary>
[Route("api/[controller]/[action]")]
[ApiExplorerSettings(GroupName = "V2")]
[ApiController]
[LoginFilter]
public class TestController : ControllerBase
{
// GET: api/<controller>
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<controller>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<controller>
[HttpPost]
public void Post([FromBody, Required(ErrorMessage = "值不能为空")] string value)
{
}
// PUT api/<controller>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody, Required(ErrorMessage = "值不能为空")] string value)
{
}
// DELETE api/<controller>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}