protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().ToTable(tableName: "users");
modelBuilder.Entity<WorkPlace>().ToTable(tableName: "workplaces");
modelBuilder.Entity<User>()
.HasRequired(user => user.Place)
.WithMany(place => place.Users);
}
public List<CustomUser> GetActiveCustomuser()
{
return context.Users
.Where(u => u.Active)
.Select(new CustomUser()
{
Name = u.Name,
Place = new CustomPlace() { Name = u.Place.Name }
})
.ToList();
}