views:

193

answers:

2

I have a website consisting of an index.html, a number of style sheet files as well as some javascript files. Then I needed a way for this site to communicate efficiently with a Microsoft SQL Server, so I was recommended to use the MVC framework to facilitate that kind of communication. I created the C#.net controller code needed to output the necessary information from the database using URL parameters, so now I am trying to put the whole web-site together inside the MVC framework.

I started an empty project-template in MVC 2 framework.

I'm sure there must be a good way to implement the current code into this framework, but I am very uncertain as to what the best approach to this would be. Could anyone point me in the right direction here? I'm not sure whether I need to change any of the current HTML, or exactly what to add to it. I'd love to see some kind of guide or tutorial, or just any advice I can get as I try to learn this.

Any help is very much appreciated!

+1  A: 

It sounds like what you need as a "Getting Started" tutorial for the MVC framework. Well it just so happens that there is fantastic tutorial featured in Professional ASP.NET MVC 1.0 available completely free on the internet. I give you: NerdDinner.

EDIT

In my opinion, the NerdDinner tutorial is a very well-rounded and complete tutorial to get you going in the right direction with MVC. The website you describe sounds quite typical and easy enough to maintain, but you will still need to edit your existing HTML if you choose the MVC route, so stressing a concern of being able to preserve your existing HTML is properly the wrong reason to go with MVC. If you want to build a simple website with a basic CRUD functionality, then MVC will likely treat you quite kindly.

Pro-tip: ASP.NET MVC's view engine is still relatively primitive and can require a lot of spaghetti code between your HTML; for that reason, you're probably going to find that allowing your designers to have their way with your production view files can be ugly and undesirable.

Nathan Taylor
That's good advice, I am currently going through that and the videos from the microsoft mvc site. But I'm hoping to get some more specific input though from folks with this kind of experiences.
cc0
+1  A: 

You could consider putting your normal pages inside the content folder, then referencing them directly, only using controllers/actions for pages that need to be dynamic. The URLs will be ugly, but if you can live with that it will get up and running more quickly. It's also possible, though I haven't tried that they could simply be in the web root. I'm pretty sure that if IIS finds an actual file at the URL it will simply serve that file up.

If you have a lot of static content, I would at least explore this option instead of artificially creating controllers/actions just to display several static pages. No need to invent a content management system if you don't have to.

tvanfosson
That makes sense. Basically the only thing I need from the MVC framework right now is just some output via url parameters, which the javascript can request independently.Thanks a lot, that is excellent input.
cc0