BKahuna
BKahuna

Reputation: 611

Tutorial for using Linq to SQL to have an MVC 3 viewmodel update a database

I am new to MVC and to Linq to SQL. I'm looking for a tutorial somewhere that can illustrate how to update a record in a database. I've Googled like wild but come up empty handed.

I have a customer table with the fields you'd expect (name, address, etc.). I've used Linq to SQL to create the domain objects and they mirror the structure of the tables in the db. I'm using a repository where I map the domain objects to my viewmodels. The viewmodels contain only the fields I need for a given view.

I know how to populate the viewmodel and pass it to a view via the controller. What I'm looking for is a good online explanation of how that view should be structured (a form I presume) and how to make it so that once the user makes changes to the record and submits I route the data in the view back and use Linq to SQL to persist it to the database.

Has anyone run across a good tutorial?

Thanks

Upvotes: 0

Views: 1772

Answers (2)

Brett Allred
Brett Allred

Reputation: 3487

www.tekpub.com

They have a good screencast on MVC2 which is really in depth and a new one they just started on MVC3. I would definately start with the MVC2 series. Also, www.asp.net/mvc has a bunch of good stuff. I started out with mvc from there creating all of the sample applications. many of them use linq2sql.

Upvotes: 0

Alex R.
Alex R.

Reputation: 4754

Seems like you have a long ways to go. I would recommend reading a good book about ASP.Net MVC. There's also a more recent book about ASP.Net MVC3 but I heard it's not as good as this one.

There are also tons of learning resources available at the main ASP.Net MVC site.

Upvotes: 2

Related Questions