I been stuck in a situation and I tried finding the solution for it on net but was not successful. I am new to MVC with Entity Framework, and it is throwing the exception wh
Your view expects model of type UnRelatedEntity.Models.MobilePhoneXchangeEntities1, but you pass result object to it. result is a database query, which you have described in controller action. So, you get expected error - type mismatch.
To fix this you should create type for your query items. Very simple example:
public class ResultItem
{
public Foo Foo { get; set; }
public Bar Bar { get; set; }
}
After that modify select statement in your query:
select new ResultItem { Foo = foo, Bar = bar };
and in the end, change model type of the view to IEnumerable, because query will return collection of result items.