I use dd4t and mvc. And I want to make queries from the controllers, make the components to view models and pass the model to the views. So when I try to pass the view model a get exception :
"The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MyWebSite.ViewModels.ArticleViewModel]', but this dictionary requires a model item of type 'DD4T.ContentModel.IPage'."
And I use the default mvc routing and I don't use the UnityDependencyResolver. I work from very soon with dd4t and I realy have no idea what else to do so I can solve this problem. Here is also the code from my controller
public class HomeController : Controller
{
public ActionResult Index()
{
Criteria criteria = new ItemSchemaCriteria(176);
SortParameter param1 = new
SortParameter(SortParameter.ItemCreationDate,
SortParameter.Descending);
Query query = new Query(criteria);
query.AddSorting(param1);
string[] results = query.ExecuteQuery();
ComponentFactory cf = new ComponentFactory();
cf.ComponentProvider = new TridionComponentProvider();
var components = cf.GetComponents(results);
List<ArticleViewModel> articles = components.AsQueryable()
.Select(ArticleViewModel
.FromArticleComponent)
.Take(7).ToList();
return View(articles);
}
}
Thanks and if you need more specifics, just tell me.