Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-05-29
2
Medium Priority
?
598 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 1000 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 1000 total points
ID: 39206773
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

916 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