Solved

ASP.Net MVC 4 C# -- create good "view-models" ?

Posted on 2013-05-29
2
564 Views
Last Modified: 2013-06-02
I currently do the below four steps to create a simple app.

Does anyone have a good URL (besides the below)
talking about how to create good "view-models" ?
-------------------------------------------------------------
http://geekswithblogs.net/michelotti/archive/2009/10/25/asp.net-mvc-view-model-patterns.aspx
http://www.howmvcworks.net/OnModelsAndViewModels/ToModelOrViewModel
http://en.wikipedia.org/wiki/Model_View_ViewModel
http://stackoverflow.com/questions/8151073/use-of-attributes-on-properties-in-mvc-3-edmx-model

 1. create new APP
 2. RMB on Models FOLDER, Add, ADO.NET Entity Data Model
      ** Server = DBTEST
      ** Database = MVC_test (make sure table has "PK=ID" so Edit, Details, Delete work
 3. REBUILD
 4. RMB on Controllers FOLDER, Add, Controller, Default1Controller
      ** Template = MVC with read/write actions and views, using Entity Framework
      ** Model Class = Table6 (MvcApplication14.Models)
      ** Data Context Class = MVC_testEntities (MvcApplication14.Models)
0
Comment
Question by:finance_teacher
2 Comments
 
LVL 38

Assisted Solution

by:PaulHews
PaulHews earned 250 total points
ID: 39206091
There are many ways to do this, and many opinions on what is the best way.

A good link on designing viewmodels:
http://lostechies.com/jimmybogard/2009/06/30/how-we-do-mvc-view-models/

Here is a possibly useful tool for mapping viewmodel back into domain
http://bengtbe.com/blog/2009/04/14/using-automapper-to-map-view-models-in-asp-net-mvc/

Discussion of best practices
http://stackoverflow.com/questions/664205/viewmodel-best-practices
0
 
LVL 19

Accepted Solution

by:
Manoj Patil earned 250 total points
ID: 39206773
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now