- Use ASP.NET and Entity Framework to build a RESTful API
- Use object-oriented programming to manage source code complexity
- Use an API client (Postman, Insomnia, etc.) or to test-drive code
It's time to use everything you've learned up to this point! Your task is to build a complete API in C# using ASP.NET and Entity Framework. Treat this challenge like a real project, not just an exercise to complete. Take time to read documentation, experiment & discuss ideas with your peers and teachers.
- Fork this repository
- Clone your fork to your machine
- Open the api-cinema-challenge solution with Visual Studio
- Update appsettings.json with your own credentials. Note that the Data folder already contains a CinemaContext which you may use to add your DbSets.
- Create the ERD to describe the model of your data and the relationships between each entity
- Check the Program.cs and do any changes needed before starting. They are marked with //TODO: comments (remember VIEW menu and TASK LIST to see these)
- It would be a good direction to use different namespaces for consistency. Ex.:
- Controllers: api_cinema_challenge.CSharp.Main.Controller
- Models: api_cinema_challenge.CSharp.Main.Model
- Everything else: api_cinema_challenge.CSharp.Main
- Finally your task is to develop the API that satisfies this API spec
Pay close attention to the details of each endpoint. How you choose to implement the solution is up to you, there are no wrong answers, but the inputs and outputs must match the provided API documentation exactly.
Here is an extension API spec.
It contains a few new routes, different approaches to data mutation and, most importantly, an entirely different response format for each request.
- When creating and entity that contains a reference to another entity, if that other entity does not exist then create that other entity if the data is correct.
- Beware of cyclical Json and Db Entities reference
- Use decorators to ignore model values to json ignore :
- You could create different Data Objects to avoid those dependencies
Entity with cyclical dependance:
{
"id": 0,
"name": "string",
"otherEntity": {
"id": 0,
"entity": { // <------- Root entity is repeated here, resulting for child entity being repeated and goes on and on.
"id": 0,
"otherEntity" {
...The whole structure repeats infinitely...
}
}
}
}
Current:
- Create the ERD
- Create models
- Create Controllers with routes to satisfy the API
- Create Relationships between the components as shown in the ERD
You'll need to do a fair amount of research in order to complete this challenge. Make liberal use of StackOverflow, search engines, YouTube and the teaching team.
Here are some reference documentation links that will be useful: