7
How would make skins in MVC? where the client(user) could choose the skin (would change CSS, html, images, etc)?
OBS¹: The Skin would be for all pages and each customer can have only 1 single skin. But I would have about 10 different skins. These skins can be just one css
different or a whole different site.
NOTE²: Imagining that Only the Controller can be the same for different skins, Ex: public ActionResult MostrarProduto()
will always return the same thing, only the view or _Layout may be different.
I imagine in three ways, but since I don’t have much experience in MVC I need to FACTS on the advantages and disadvantages of each, of course it may be that none of the 3 ways I imagine is the best.
1 - Filters in the controller:
[VerificarSkin]
public ActionResult MostrarProduto()
{
2 - Changing the Layout file by Controller or View
@{Layout = ViewBag.SkinAtual;}
3-Changing the View Folder [Video explaining this solution]
public ActionResult MostrarProduto()
{
var skinAtual = "skin12";
return View("../Views/" + skinAtual + "/Home/index.cshtml");
Solutions:
1 - Advantages: Code cleaning,
2 - Advantages: I take the same view for all skins mute only the layout, but then it can also be a disadvantage can not customize the view?
3 - Advantage: I can change everything, view and Layout, but it would take more work?
Scenario: Today I have 300 clients(users) where each one owns their site, these sites are shared from my tool, where he can choose the skins (which are from color changes to totally different layout)
Your idea and swap skins for user, page, by permission? Better, if choosing a skin will be the same for all pages, or I can choose one for each page, etc?
– Randrade
each customer would have only one skin that would be applied to all pages!
– Dorathoto
When you say customer you refer to each user who access the system or your system has multiple customers and each customer can have multiple users? I am asking these questions, because the context of your system, may change some factors. But, the third form seems to me unfeasible, so far.
– Randrade
good questions I will update the question. customer = user.
– Dorathoto
Which authentication method, Identity?
– Randrade
none, I identify the client by its url, so I know which site is which Clienteid is. The site is user anonymous, is a site and not an admin.
– Dorathoto