NET7下的WEB API示例
[Route("api/[controller]")] [ApiController] public class ShopADController : ControllerBase { private readonly IRepository<Model.ShopAD, int> _shopAD; public ShopADController(IRepository<ShopAD, int> shopAD) { _shopAD = shopAD; } //http://localhost:5000/api/shopad [HttpGet] public string Get() { return "getget"; } //http://localhost:5000/api/shopad/banner [HttpGet("banner")] public List<Model.ShopAD> Banner() { return _shopAD.GetAllList(a => a.Remark == "banner"); } }
标签:WEB,shopAD,示例,api,NET7,public From: https://www.cnblogs.com/niunan/p/17605055.html