1 Replies - 5172 Views - Last Post: 12 April 2013 - 09:57 PM

#1 Vouksh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-September 12

I Just Don't Get MVC...

Posted 09 April 2013 - 07:19 AM

I've been trying to learn ASP.NET. I've been using C# since probably 2006/2007 or so, and I've pretty much only used it for Desktop Applications so far. But I've been wanting to get back into web design a little. I originally used PHP years ago when I dabbled in it, and am used to the simple structure of simply like, index.php, blog.php, forums.php, posts.php, with each doing their own thing, and using apache mod_rewrite to make the URLs "pretty", and having an "includes" folder that had more utility/backbone code in it, such as handling MySQL connections, file uploading, user authentication, etc.

Now I'm trying to learn ASP.NET MVC. I'm starting out using WebMatrix, with Razor (v2?). And none of the default templates seem to even come CLOSE to what I see in tutorials and such on MVC, and I'm trying to figure out exactly what MVC is for.

What is a Model? What does it DO? What does it handle?
Same with a controller, and a view?
I sorta get the views thing, it's just the actual layout. But how in the world does your website go from example.com/Post/12341/I-Like-Pie to ~/Views/Posts/ or whatever? I have a functional website, and it "works" but I REALLY want to learn the true and proper way of doing this.

Right now what I've got seems to be a mashup of PHP and ASP.NET. The website is up at http://www.lexdysia.com/ (I'm not 100% done with it, I stopped so I could rebuild to be more "proper")
if you want to see the actual code, I took out my personal stuff (passwords, emails, server details, etc) zipped it up.
http://misc.vouksh.com/lexDysia.zip

It's exceedingly frustrating, as every time I try to google something, I get results from like, 10 years ago! Or if it's not, the articles simply seem to assume you know exactly what they're talking about.

Is This A Good Question/Topic? 0
  • +

Replies To: I Just Don't Get MVC...

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 445
  • View blog
  • Posts: 1,501
  • Joined: 28-April 09

Re: I Just Don't Get MVC...

Posted 12 April 2013 - 09:57 PM

WebMatrix uses something slightly different from either WebForms or MVC called WebPages. If you're using WebMatrix you might have better luck googling that instead of MVC.

The Model is basically what handles the logic for the data and is used to pass data to the views. When a user opens one of your webpages the request is routed to the controller which then selects the appropriate view and passes it whichever model it's been told to pass to it. The view then builds the web page using the data from the model.

Here's the ASP.NET websites page for WebPages
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1