<rant>

I don’t know if it comes from laziness in changing a default name from a template, or a misunderstanding of the attributes HttpGet, HttpPut, HttpPost, HttpDelete or HttpHead.  Regardless, having a WebAPI method name in code called Get() for a single method with an HttpGet attribute, Put() for HttpPut, etc… is bad practice.

Use method names which reflect the true functionality of the method.  E.g.

[HttpGet]

public async Task<User> GetUser(…)

[HttpPut]

public async Task<User> UpdateUser(…)

[HttpPost]

public async Task<User> CreateUser(…)   // or AddUser(…)

[HttpDelete]

public async Task<User> RemoveUser(…)   // or DeleteUser(…)

 

Why?

This is not so much for the server code, although it will be useful when you have more than one, HttpGet, HttpPost, etc method on the controller.  It is actually for the client code.

What’s easier to read in client code you see for the first time:

var x = ctl.Get();

..or..

var x = ctl.GetUsers();

var x = ctl.GetUser(string name);

The intended functionality can be traced with argument patterns, and “Go To Definition” jumps.  But changing method names to match specific intent makes code read like a book.

Food for thought: hopefully you will see the value of leaving good, well-formed code to the inheriting developers of your code.

</rant>