I am doing a mobile app with Angular and MVC. I am doing my app calling some dummy data from the json model in the web api. Check my code below:
private IEnumerable<JsonModel> events = new JsonModel[]
{
new JsonModel {Id = 1, Title = "title1"}
new JsonModel {Id = 2, Title = "title2"}
};
// GET api/<controller>
public IEnumerable<JsonModel> Get()
{
return events;
}
// GET api/<controller>/5
public JsonModel Get(int id)
{
return events.FirstOrDefault(e => e.Id == id );
}
What I want to do now is to connect my project to the real database. How can I do that?