I'm quite new to ASP.NET MVC in fact this is my first ever project using it. I want to build simple TaskList. I'm fairly fine in ASP.NET but know almost nothing about ASP.NET MVC or Linq so please keep this in mind while answering.
I'm using CodeFirst Entity Frameword to generate Db.
I have two tables Users(id,name) and Tasks(id,userid,name). I have created two Model objects which hold Users and Tasks properties. So instead of having int userID as database design would suggest i have an User class inside of Task class to connect Task to certain User.
Somehow i've managed to create join using LINQ
var model = from t in _db.Tasks
join u in _db.Users on t.User.ID equals u.ID
select new { UserID = u.ID,UserName = u.Name,t.Name,t.ID };
return View(model);
but i cannot bind it to a view, i binded it to Task Model which probably cause this error.
How do i solve this issue, maybe there is some kind of ViewModel i need to create or something like that?
Thanks...