About two years ago, I started working on a movie database app so that I could learn how to do web forms development in ASP.NET. It looks terrible, but it functions, and it gave me some good insight, and was good practice.
So when I decided that I wanted to take a trip down MVC Lane, I figured I would update my Movie Database app so that it, A.) Looked Nicer, and B.) was built the MVC Way. This required rewriting the application from the ground up.
I decided to break the project up into two parts – one an API that did database connections and served up the juicy details about movies that I wanted. It would have four main parts:
- AddMovie – The ability to add a movie to the Database
- RemoveMovie – If I no longer have a movie, I don’t want it showing up on my lists.
- GetMovie – Get a single movie’s details (By ID)
- GetAllMovies – Get all of the movies.
For the original, I had used the OMDBAPI – a decent little service that I am grateful for. The fact that it’s free and useful is also beneficial. I continue to use this in the new version, (which will be released open-source when I finish it) because it is a useful tool. They offer me, (as a sponsor) a monthly dump of all of their movie data, but that’s more than I want. I mention it here because you may find it useful for a project in the future. Data is cool, kids. Eat as much as you can; it has 0 calories.
For the main app, there are a few features that I was certain I wanted to have. The main one being that you could go to url.com/movies/4 and get the movie associated with ID# 4. If I were planning to make this public, I would also have that work with a title, too, probably. For SEO optimization.
I also wanted an interface where I could search OMDBAPI for new movies to add, and I didn’t want to put in the specific title of the movie. I wanted to be able to search for “Star Wars” and see everything they had on Star Wars; I could search myself beyond that. In order to ensure that I was getting the right information, though, I had to see the full Name of the movie, the year it was produced, (to make sure I’m not picking a remake accidentally) and the IMDB ID (so I can do further research.) – All included in the basic search call to OMDBAPI, so this wasn’t an issue at all.
I did run into an issue trying to “Add” the movie to my database; apparently WebAPI 2.0 does not have native support for multiple POST parameters. At best, they expect two simple parameters, or one simple parameter and a complex object. I found a class online that modified this behavior, but instead I went back and re-worked my API to accept a complex object; it works better that way, and isn’t nearly as messy. (Especially since there are 36 fields!)
I’m pretty happy with the project so far, and with a little more tweaking on the API, I’ll have the whole thing ready to Open Source, and then I can move on to my next project. I’ll throw a link up on this post to my Open Source website whenever I’ve got it done and released.