NewGaoKaoApi/New_College.Api/Controllers/v2/ApbController.cs

33 lines
976 B
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using New_College.SwaggerHelper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using static New_College.Extensions.CustomApiVersion;
namespace New_College.Controllers.v2
{
[CustomRoute(ApiVersions.V2)]
//[Route("api/[controller]")]
[ApiController]
[Authorize(Permissions.Name)]
public class ApbController : ControllerBase
{
/************************************************/
// 如果需要使用Http协议带名称的比如这种 [HttpGet("apbs")]
// 目前只能把[CustomRoute(ApiVersions.v2)] 提到 controller 的上边做controller的特性
// 并且去掉//[Route("api/[controller]")]路由特性,否则会有两个接口
/************************************************/
[HttpGet("apbs")]
public IEnumerable<string> Get()
{
return new string[] { "第二版的 apbs" };
}
}
}