TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marius Vasile
563
1.9k
143.3k
How can I join two unrelated table in a SelectList?
Dec 11 2020 1:39 AM
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
Reply
Answers (
1
)
TempData in mvc concept
View File From NAS Server to Web Browser