2

I Have small question about general convention:

Is Creating some controllers that we can call "shared" in general is a good approach? What do You think about that, and maybe You have some alternatives ?

i.e. : I have controller "User" - It's common controller, some authenticate method, profile edit etc. Beside that I create "UserShared" controller - I'll use it in many views (Html.RenderAction) to get some PartialViews i.e. AccountMenu, MessageStatus etc. My intention of that approach is to make views as dumb as it's possible and don't mix "shared" (in most cases returns only PartialViewResult) actions and common one.

1 Answer 1

2

If functionality is common across controller you can use base controller. Some may argue against it due to coupling issue. You may read here and here

Sign up to request clarification or add additional context in comments.

3 Comments

Ok, I understand what You mean, but I thought about actions shared between many Views, not Controllers- about actions i.e. that returns PartialViews with some menu. And then I Can use it in an View like that: @Html.RenderAction("GetUserRelatedMenu","UserShared")
I have implemented the menue using shared controller and it works fine. Have u any reference regarding your idea
No - that's why I'm asking :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.