Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am working on a web application implemented in C#, that follows MVC conventions.

This application contains a page that allows me to create or update a Wingding. The view passes a complete Wingding Model back to the controller for me to create or update.

The problem is that the page also has a checkbox that allows me to create identical Wingdings for all users. The current code adds a variable to the Winding Model to capture that data, so it can be passed back from the view.

It seems obvious to me that the page should have a Wingding Page Form object that is passed back from the view to the controller, instead of adding extra variables to the Model that won't get saved to the DB.

I know that this counts as separation of concerns, but is there a more specific design pattern that describes the separation of a From from a Model?

share|improve this question
If that's your use case isn't there the need for a reference to the user in the model? Your scenario does not make sense to me. Either you store these things in completely different databases or they are stored in the same db, but then they are either required to have different identities or references to users. If your model is setup correctly, I doubt there's a problem here. Imho the problem is in your model. But you can always have a PresentationModel if you really need one. Still, I think the flaw is in your model. –  Falcon Dec 1 '13 at 19:06
@Falcon - In my case, I don't need any reference to a list of users, since the checkbox actually indicates that identical wingdings should be created for all users, not just the one I'm editing. I edited my question to reflect that. –  Gustav Bertram Dec 1 '13 at 21:17

2 Answers 2

up vote 2 down vote accepted

Sounds like you're looking for a View Model.

The View Model is an object that encapsulates only the data that is required for the View to display. Example:

public class UserInformationViewModel
    public string DisplayName { get; set; }
    public string Address { get; set; }
    public string City { get; set; }
    public string StateID { get; set; }
    public string Zip { get; set; }

    public SelectList States { get; set; }

In this example, States is a list of states or provinces, used to populate a drop down list. The data is sourced from multiple tables, but contained in a single object.

In smart client scenarios, the View Model can also contain view logic, such as validation and display modification based on user-selected data.

share|improve this answer
The concept is somewhat elaborated on in this link: geekswithblogs.net/michelotti/archive/2009/10/25/… –  Gustav Bertram Dec 2 '13 at 12:52

There're multiple solutions:

1.) IMHO the cleanest solution is to have that checkbox as a separate field and pass it to the controller, so it knows what to do.

2.) You can use a PresentationModel pattern to encapsulate everything the controller needs to know and pass that object.

Apart from that, I believe, the way that you are describing your use case, that you have a flaw in your model. If you create the same items for multiple users, then your discriminator is a reference to the user in your model, isn't it? So you need to pass the controller your blueprint of the winding and the list of users.

share|improve this answer
The PresentationModel seems to be more concerned with formatting data for the view according to this. My problem is the opposite, in that I would like to return a single object from the view to the controller, but in that I don't want to pollute my Model object with extra fields for controls on the view. –  Gustav Bertram Dec 2 '13 at 12:55
@GustavBertram ViewModel is a form of PresentationModel. FYI: The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that originated from Microsoft as a specialization of the Presentation Model design pattern (wikipedia) –  Falcon Dec 5 '13 at 17:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.