简体   繁体   中英

Changing name to method into controller (Swagger)

I'm new to Swagger and Web API. I created a Web API project with a simple controller called PrimeCalculator.

public class PrimeCalculatorController : ControllerBase { 

   [HttpGet]
   public IEnumerable<string> Get() {
    //stuff 
    return new string[] { "value1", "value2" };
   }

}

So my method in Swagger looks like this:
在此处输入图像描述

As you can see, there is one method with a get call. So far so good, but now I want to change method name. I found this:

[Http(name="newMethodName"]

However, the method's name stays the same. I don't know if I'm missing something. Any tutorial to learn or help is welcome.

Results after changing the method name (nothing changes):
结果

[Http(name="newMethodName")] -> [HttpGet("newMethodName")]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM