AngularJS API Call with Id as param and C# Contoller
<p>I hope you can help me. I feel like pulling my hair out! </p>

<p>I am trying to make an API call with an Id as the passed parameter to find a specific record. </p>

<p>Something like this: <code>$http.get("/api/vendor/ReadVendor/" + vendorId)</code></p>

<p><strong>What needs to happen:</strong></p>

<p>When I select a Vendor the call to the API is made with the unique Vendor id. This is passed to the Controller and DTO and DB, and return the specified data.</p>

<p>I get an error: </p>

<p><strong><em>404/Not Found {"Message":"No HTTP resource was found that matches the request URI '<a href="http://localhost:60090/api/vendor/ReadVendor/5" rel="nofollow">http://localhost:60090/api/vendor/ReadVendor/5</a>'.","MessageDetail":"No action was found on the controller 'Vendor' that matches the request."</strong>}</em></p>

<p><strong>My stack flow is something like this:</strong> </p>

<ol>
<li>adminVendorNumber.html  </li>
<li>adminVendorNumber.controller.js</li>
<li>VendorController.cs</li>
<li>VendorDTO.cs</li>
</ol>

<p><strong>Here is part of my adminVendorNumber.html used for the call to the AngularJS function:</strong></p>

<pre><code>                        &lt;label&gt;Vendor&lt;/label&gt;
                        &lt;div class="input-dropdown"&gt;
                            &lt;cc-dropdown cc-placeholder="Select Vendor"
                                         ng-model="NewVendorNumber.Vendor"
                                         ng-disabled="false"
                                         ng-options="vendorData"
                                         cc-fields="VendorId"
                                         cc-key-field="VendorId"
                                         cc-allow-search="false"
                                         ng-required="false"
                                         ng-change="vendorSelected()"
                                         name="iVendor"&gt;
                            &lt;/cc-dropdown&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
</code></pre>

<p><strong>This is my AngularJS controller (part of it with my specific function):</strong></p>

<pre><code>(function () {
    "use strict";

    angular
        .module('app.adminVendorNumber')
        .controller('adminVendorNumberController', adminVendorNumberController);

    adminVendorNumberController.$inject = ['$http', 'logger', '$scope'];

    function adminVendorNumberController($http, logger, $scope) {
        var vm = $scope;
        vm.formSubmmision = true;

        vm.vendorItemData = null;
        vm.itemGroupData = null;
        vm.vendorData = null;

        vm.vendorSelected = vendorSelected;

        vm.save = save;

        activate();

        function activate() {
            return vendorItemData().then(getAllItemGroups).then(getVendorData).then(function () {
                logger.info('Activated Vendor Number Creation');
            });
        }


        function vendorSelected() {

            vm.formSubmmision = true;
            return getVendorById(vm.NewVendorNumber.Vendor.VendorId);
        }

        function getVendorById(vendorId) {
            return $http.get("/api/vendor/ReadVendor/" + vendorId)
                .then(Success)
                .catch(Failure);

            function Success(responce) {
                vm.vendorSelected = responce.data.Records;
                return vm.vendorSelected;
            }

            function Failure(error) {
                logger.error('Failed to get Vendor Data ' + error.data.Message);
            }
        }

    };
}
)();
</code></pre>

<p><strong>Here is part of my VendorController.cs function that is called:</strong></p>

<pre><code>    public class VendorController : ApiController
    {
        private VendorDTO dto = new VendorDTO();

        public HttpResponseMessage ReadVendor(int vendorId)
        {
            try
            {
                CommandResult&lt;Vendor&gt; result = dto.ReadVendor(vendorId);
                return Request.CreateResponse((result.Status == CommandStatus.Success ? HttpStatusCode.OK : HttpStatusCode.InternalServerError), result);
            }
            catch (IOWAException ex)
            {
                return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
        }

    }
}
</code></pre>

<p><strong>Here is the next step where the VedorDTO.cs is called:</strong></p>

<pre><code>public class VendorDTO
{

    public CommandResult&lt;Vendor&gt; ReadVendor(int vendorId)
    {
        return readVendor(vendorId);
    }

    private CommandResult&lt;Vendor&gt; readVendor(int vendorId)
    {
        CommandResult&lt;Vendor&gt; result = null;

        try
        {
            VendorContext dalVendor = new VendorContext();
            result = dalVendor.Read(vendorId);
        }
        catch (IOWAException ex)
        {
            result = new CommandResult&lt;Vendor&gt;(ex, "Error reading Vendors");
        }

        return result;
    }
</code></pre>