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 8456887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:39:52+00:00 2026-06-10T12:39:52+00:00

I am building a cms, on the edit screen for a section you can

  • 0

I am building a cms, on the edit screen for a section you can edit multiple types of pages, the urls need to remain nutral, like this:

foobar.com/edit/section/my-content-page-name
foobar.com/edit/section/my-gallery-page-name
foobar.com/edit/section/my-blog-page-name

In this scenario the Index action is used for both gets and posts.

At the moment I have one massive ViewModel, that encompasses all the data required across all page types.

I feel this is quite wrong and, makes an ugly solution for deciding what type of page update on the post.

How can I keep the Action the same but use it with different strongly type ViewModels?

Is this even possible?

public ActionResult Index(string page)
    {
        var model = _pageManager.GetSection(page, SelectedSite);
        return View(model.PageType, model);

        // renders appropriate View based on page type.

    }

    [Transaction]
    [HttpPost]
    [ValidateInput(false)]
    public ActionResult Index(SectionIndexViewModel model)
    {
        // all page types post back to same action to update content etc.
        // at this point SectionIndexViewModel is getting bloated with properties because it must cater for ALL page types data.

        var action = Request["action"] ?? "";

        // currently use this to determine what event has been triggered 
        switch (action.ToLower())
        {
         // then goes to update the appropriate page, blog or gallery
         // etc.
  • 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-10T12:39:53+00:00Added an answer on June 10, 2026 at 12:39 pm

    I managed to achieve this with some MVC basics that I had forgotten about.

    The routing remains as per the defaults.

    For each ViewModel type I delivered an extra hidden field in the form, with the type of the page/content/ViewModel eg: Content Page, or Blog Page etc.

    In the Post action, I check the type of the page from this hidden field.

    Then use TryUpdateModel using the expected ViewModel type for that page type.

    And the rest is straight forward.

    Pretty basic stuff really.

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

Sidebar

Related Questions

I am building a small cms system. The user can login and edit, delete
I'm building some crude CMS-like functionality (to get acquinted with Play Framework). For this
I'm using IIS7 and ASP.NET. Basically building a simple CMS and need to handle
We are building a simple CMS with asp.net 3.5 and mssql2005 We need to
New to PHP/MySQL and building a CMS. I need to know how to associated
I am building a web CMS in which the user can choose colours for
I'm building CMS like application. For example my BlogPost page contains several widget areas.
I am building a CMS where a user can customize the SEO URL of
I am building a website and need to use a CMS. If I use
I am building a CMS for editing page content. I would like to make

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.