- Opened VS, new project, ASP.NET Application (.NET Framework)
- Name WebApi
- Select Web API
*keep MVC and API checked
*change authentication to no authentication - Click OK and let VS build project
- Add the Chinook Connedtion string to the Web.config
- Make a Model for Artist
- Make a ApplicationDbContext class in the Models folder
- Make a ArtistController by right clicking on the Controllers folder and selecting Add => Web API controller class
*Name the class ArtistController.cs - Install Entity Framework into the project
10.Add properties to the Artist.cs class
Set-up the ApplicationDbContext.cs class (same as MVC)
*Add:config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));to the App_Start.WebApiConfig.cs file
*Run and appended /api/artist to the url to bring back a list of artists.
lynnsamuelson/IntroApi
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|