This is my method with the linq expression:
FantasySport _db = new FantasySport();
[AllowAnonymous]
public ActionResult Register()
{
var q = from t in _db.User
select t;
foreach (var item in q) {
var a = item;
}
return View();
}
This gives me 0 rows back. If i put a breakpoint on the row var a = item; it won't even stop there because there is no items in q. This is the data in my database:
Here is my dbset class:
namespace SportsFantasy.Models
{
public class FantasySport : DbContext
{
public DbSet<UserProfile> User { get; set; }
public DbSet<Team> Team { get; set; }
public DbSet<TeamPlayer> TeamPlayer { get; set; }
public DbSet<Player> Player { get; set; }
public DbSet<Games> Games { get; set; }
public DbSet<League> League { get; set; }
}
}
What is the problem? Ive been looking for a answere a long time now. Why doesn't i get the values from the database? It's my first time doing a code-first EF project so it could be some easy thing i just missed.