Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

I have two controllers with API methods, only one shows up in discovery

$
0
0

I added a controller, and both have Web API methods.

I even copied this controller from another project that has the discovery working (when you click API, all the methods and url's are shown).

But for some reason in my new project, the discovery doesn't show the class I want.

Is there something I have to do to make this discovery work?

The default ValuesController works, but my custom controller that only has 1 method for now doesn't show.

The controller class is here:

  public class TestOpAPIController : ApiController
    {
        #region Methods
            #region GetClients()
            /// <summary>
            /// method Get Clients
            /// </summary>
            [Route("GetClients")]
            [HttpGet]
            public static List<Client> GetClients()
            {
                // initial value
                List<Client> clients = new List<Client>();
                // Create a context
                WebDbContext context = new WebDbContext();
                // load the companies
                List<Company> companies = context.Company.ToList();
                // convert the Companies to Client objects
                clients = Convert(companies);
                // return value
                return clients;
            }
            #endregion

        #endregion


Viewing all articles
Browse latest Browse all 4850

Trending Articles