MVC 5 Routing Question

I am an MVC newbie

I have a controller that feeds from a view  I am using route attributes

View Index


The categories and documents are read from a database that is generate in another view

@foreach (var item in Model.ArticleList)
{
         <a href="/Article/@item.Category/@item.document">Read More...</a>
}

-------------- Controller ------------------------- with route attributes

        [Route("Article/{Category}/{Document}")]
        public ActionResult  Article(String Category, String Document)
        {                
            ..... Read data in ...............
            ...... get data from model for  Article To Display
            ..........................................
            return View(Model  ArticleToDisplay);
        }


I have dozens of categories and hundreds of documents and the categories are growing in the database

I need one view that I can pass the values and display it. There is no way I can physically create a view for each controller.

Lets say one of the categories is RootCauseAnalysis and a document is Equipment-Operators-Improve-Reliability  what I get is

The view 'Article/RootCauseAnalysis/Equipment-Operators-Improve-Reliability' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Article/Article/RootCauseAnalysis/Equipment-Operators-Improve-Reliability.aspx
~/Views/Article/Article/RootCauseAnalysis/Equipment-Operators-Improve-Reliability.ascx
~/Views/Shared/Article/RootCauseAnalysis/Equipment-Operators-Improve-Reliability.aspx


How can I get around not making a view for each category???


Thanks
Charles BaldoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
you don't need a separate view for each model. You seem to be making an error in thinking every category requires a distinct model you would use the category as a variable that will be passed to the controller the controller will pass data back to the model which will then pass the data back to the view

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Charles BaldoSoftware DeveloperAuthor Commented:
David,

Thanks, I got it about a half hour after I posted this.  I have it working now
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.