Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading