I have two unrelated tables and I want to join PTWTypeName from first table and PTWTypeNameOrg from the second one into a SelectList.
- public class PTWType
- {
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public string PTWId { get; set; }
- public string PTWTypeName { get; set; }
- }
- public class PTWTypeOrg
- {
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public string PTWIdOrg { get; set; }
- public string PTWTypeNameOrg { get; set; }
- public string OrgID { get; set; }
- }
What I tried is
- var ptwType = await _context.PTWTypesOrg
- .Join(_context.PTWTypes, t1 => t1.PTWTypeNameOrg, t2 => t2.PTWTypeName, (t1, t2) => new
- {
- PTW1 = t1.PTWTypeNameOrg,
- PTW2 = t2.PTWTypeName,
- }).ToListAsync();
-
- PTWTypeSL = new SelectList(ptwType);
but no result in the SelectList