your code:
public ActionResult Index()
{
var Q = from a in _ObjectEntities.Events
join b in _ObjectEntities.Employees on a.Incharge equals b.Id
select new {
EventId = a.EventId,
EventName = a.EventName,
EventType = a.EventType,
EventDate = a.EventDate,
Incharge = b.Name
};
return View(Q.AsEnumerable());
}
Change to this:
public ActionResult Index()
{
var Q = from a in _ObjectEntities.Events
join b in _ObjectEntities.Employees on a.Incharge equals b.Id
select new EventsModel {
EventId = a.EventId,
EventName = a.EventName,
EventType = a.EventType,
EventDate = a.EventDate,
Incharge = b.Name
};
return View(Q.AsEnumerable());
}