Web App Error While Returning Data from a Database

Amos Matthew 26 Reputation points
2021-07-15T00:22:48.06+00:00

I am connected to an Azure Database in Visual Studio. Using this method, I should retrieve JSON response from the Database (According to Instructions) that looks like this:

{"CustomerID":1,"Title":"Mr","FirstName":"Orlando","LastName":"Gee","EmailAddress":

"orlando0@adventure-works.com","Phone":"245-555-0173","rowguid":

"3f5ae95e-b87d-4aed-95b4-c3797afcb74f","ModifiedDate":"2001-08-

Instead, I get this Error Message:

<Error>

<Message>No HTTP resource was found that matches the request URI 'http://localhost:5000/api/Customers/1'.</Message>

<MessageDetail>No type was found that matches the controller named 'Customers'.</MessageDetail>

</Error>

Can you say why my method is returning this data instead of a Customer data file? My method:

// GET: api/Customers/5

    [ResponseType(typeof(Customer))]

    public async Task<IHttpActionResult> GetCustomer(int id)

    {

        Customer customer = await db.Customers.FindAsync(id);

        if (customer == null)

        {

            return NotFound();

        }

        return Ok (customer);

    }
Azure SQL Database
{count} votes