添加项目文件。
This commit is contained in:
50
HT.Cloud.Web/Controllers/Api/TestController.cs
Normal file
50
HT.Cloud.Web/Controllers/Api/TestController.cs
Normal file
@ -0,0 +1,50 @@
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user