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 { 

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


So my method in Swagger looks like this:
enter image description here

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:


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):

>Solution :

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

Leave a Reply