I see what your problem seems to be:
You have a typo near the end. Change this:
[HttpGet]
public ActionResult> Load()
{
for this:
[HttpGet]
public ActionResult< IList < string > > Load()
{
It seems that you are missing some code there.
And, answering to your questions:
1) - Why did you tell me to call with the link 'http://localhost:5000/api/departments/load' and not 'http://localhost:5000/api/sample/load' ?
A.- It was just an example I was trying to illustrate. The best practice is to name the controller with plural and using the word Controller along the way. So, if you have a Controller that will handle the operations related to the users, a good idea would be to name it: UsersController.
2) - where do I find the settings to decide the link of the WEB API ? (http://localhost:5000/api/sample/load' )
A.- That is done with the Route Attribute. You may find it right after declaring the namespace. For example:
namespace Cs1Tris.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class Controllore : ControllerBase
{
So, if you change the values from within the Route attribute, then you can define the route of your Web API Controller. In this sense, and referring to your example, you would change the word [controller] with Controllore and the word [action] with Load. The end result would be http://localhost:5000/api/Controllore/Load
I hope this helps you understand it better.
Regards,
I realize I am a noob
G.
And a link into Microsoft's fundamentals intro:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/?view=aspnetcore-2.1&tabs=windows
Lots of info. Too much to learn everything upfront. But good link to start learning.
/Michael
Hey Gimmy - and everyone else new to C# though experienced in PowerScript.
Remember as you read C# :: C# is case sensitive - which means the following identifiers are completely different seen in C# code though totally identical seen in PowerScript code:
d_customers -- d_Customers -- D_Customers -- D_Customers -- D_CUSTOMERS -- d_cUstOmErs
And in C# you have namespaces which in PowerScript would be like referencing class names by PBLibrary. Say in PB I have n_calculator in Utility.PBL and later in library list same class name in Science.PBL. If PowerScript had namespaces, it would be like:
lnv_calc = create Science.n_calculator
In PowerScript, multiple classes identically named of identical type across multiple .PBL files => First in Library List wins.
HTH /Michael