Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:42:38+00:00 2026-06-10T11:42:38+00:00

I am probably over analyzing here, but with all the reading I have done

  • 0

I am probably over analyzing here, but with all the reading I have done on MVC, there seem to be so many opinions on how to do things.

Is there a “Best Practices” site or document out there that defines the responsibility of each piece of MVC?

The few questions I have, keep in mind I am using the EF/Repository&UnitOfWork/Service pattern are:

1) How to get the validation results (error messages, etc) of Domain Objects and Business Rules from the Service Layer to the View Models?

2) I am using Domain Objects and a Service Layer that does all the Business Logic, then I send the Domain Objects to the controllers and let them (via AutoMapper) convert them to View Models for the views. What other types of things are the responsibility of the controller? Is the following code OK? Is this too much logic in the controller?:

public ActionResult SomeAction()
{
    var model = Mapper.Map<DomainObject, ViewModel>(service.QueryReposForData());
    model.SomeCollectionForSelectList = Mapper.Map<IEnumerable<DomainObject>, IEnumerable<ViewModel>>(service.QueryReposForSelectListData());
    return View(model);
}

I don’t think that the only thing in a controller is one line that returns a view with an object graph mapped to view models?

3) I think it is OK to have properties on the ViewModels that can indicate to a view if something can be hidden for example and then perform that logic in the view? Example:

@if(Model.DisplaySomething)
{
    <div>Something to show</div>
}
else
{
    <div>Something else to show</div>
}

4) I was thinking of having my services return some sort of TransactionResult object back to the controllers on writes to make it the responsibility of the service to handle the transaction. So I would have an aggregate service that would start a transaction (UnitOfWork) do what ever it needed to do and then return this TransactionResult that could have error messages? I don’t think I should make the controller responsible for managing the transaction, but rather have it just pass in a view model mapped to a domain object to the service and let it act on it?

5) Also, how much of ActionFilter’s do you want to use? I know it is a huge extensibility point, but I often find myself trying to stuff all of the model creation into a filter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:42:39+00:00Added an answer on June 10, 2026 at 11:42 am

    Just opinions here based on how we work.

    We keep our Controllers so skinny they are anorexic, in almost every case.

    As for ViewModels, we follow the pattern of having a ViewModel for every view. The Controller loads it up with anything it needs, and kicks it off. From there, the ViewModel drives everything. In our world, the ViewModel is tied directly to the view and contains no code that would/could be used in other parts of the application. It interacts with any part of the larger ‘Model’ (service layer, etc) that it needs to and packages stuff up for the View to consume.

    For your #3 example, I’d say absolutely yes – it’s the way we use our ViewModels.

    Again, none of this is gospel – just my take on how we handle it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I'm probably over-analyzing this problem, but... Given table A with two one-to-many relationships
So, here's a question that will probably have the SQL experts jumping all over
I have code that all over the place(probably 20-30 instances) does this: <widget>.setVisible((condition ==
This is probably an obvious question to many but I'm scratching my head over
probably a straightforward to the trained eye but I have agonised over this for
Probably something really simple, but I'm having some real trouble with it. I have
Probably something simple, but heres my problem, I have implememnted a simple captcha into
Sorry, this is probably a duplicate question, but how can I iterate over a
I'm probably over-thinking this, but I've been stuck on it a while, so I
I know this question has probably been answered over 200 times and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.