c# - ASP.NET-MVC data/model best practices for a newb -


I am fairly new to ASP.NET MVC and MVC in general. Moving old school "spaghetti" design practices into webforms was a major change, but it seems bigger (but better) in my mind.

I have some questions about data specific tasks.

  1. For simplicity, say that I have another table named Pin with a database table named PinID INT, column structure and column entry of VARCHAR (50), INT INT, Pinid INT .
  2. I have a MVC view that takes the string value in the form of a zip code.
  3. The goal is to insert a line in the entry table. To do this, I should look at the respective PINID for the value provided.

My question is, where do I do this lookup of data? I can easily do this in the controller, where I am inserting a new entry object, but is it correct? Should this look be done in a model?

In addition to this, I am following the instructions and practices mentioned in WROX's Professional ASP.NET MVC 1.0. I have created a Data Validator Class which handles all my DB heavy lifting, and use the verification class described in that book.

Any insights will be welcomed because I am a perfect novice for MVC.

Cheers and thanks stackers!

model builder . It allows you to define how you get information about the data you are sending for your work in your model object. Your action can only take the type of argument that you want to save, and in your modelbacker, you can do some search against repositories and so on.

If you do this then there are many good blog posts on this one search, now you know to see Modelbender, Scott Hunselman has a good basic one:

< / P>


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -