@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http ;
using Microsoft.AspNetCore.Authorization ;
using Microsoft.AspNetCore.Http ;
using Microsoft.AspNetCore.Mvc ;
using Microsoft.AspNetCore.Mvc ;
using Microsoft.Extensions.Logging ;
using Microsoft.Extensions.Logging ;
@ -29,6 +30,7 @@ namespace SwaggerStudy.Controllers
_studentServer = studentServer ;
_studentServer = studentServer ;
}
}
[AllowAnonymous]
[HttpGet]
[HttpGet]
public ResultBase GetAll ( )
public ResultBase GetAll ( )
{
{
@ -67,6 +69,7 @@ namespace SwaggerStudy.Controllers
/// </example>
/// </example>
/// <remarks>我是Remark注释</remarks>
/// <remarks>我是Remark注释</remarks>
/// <param name="studentId" example="1">学生Id(变量在路由中时, example才有用)</param>
/// <param name="studentId" example="1">学生Id(变量在路由中时, example才有用)</param>
[AllowAnonymous]
[HttpGet("{studentId:int}")]
[HttpGet("{studentId:int}")]
public IActionResult Get ( [ FromRoute ] int studentId )
public IActionResult Get ( [ FromRoute ] int studentId )
{
{
@ -80,6 +83,7 @@ namespace SwaggerStudy.Controllers
return Ok ( apiResult ) ;
return Ok ( apiResult ) ;
}
}
[AllowAnonymous]
[HttpGet]
[HttpGet]
[ActionName("GetAsync")]
[ActionName("GetAsync")]
public async Task < IActionResult > GetAsync ( int studentId )
public async Task < IActionResult > GetAsync ( int studentId )