TheMentor
TheMentor

Reputation: 464

@model dynamic in mvc 3

I am just curious about "@model dynamic" in mvc 3. Correct me if I am wrong but if you use this on a particular view then in your controller you can do this:

public ActionResult RandomView(int number)
{
    if (number == 5)
    {
       ModelFive model = new ModelFive();
       return View(model);
    }

    if (number == 6)
    {
       ModelSix model = new ModelSix();
       return View(model);
    } 
 }

I there anything else I am missing with 'dynamic' keyword? Somehow i did not find any useful doc.

Upvotes: 1

Views: 1274

Answers (1)

harryovers
harryovers

Reputation: 3138

take a look at this question. it goes through using the ExpandoObject to create a dynamic model.

Upvotes: 2

Related Questions