raman p

raman p

  • NA
  • 24
  • 1.7k

i have two join query in repository and how to concat that

Sep 8 2018 2:31 AM
public IList<UsersVM> validation(string UserName,string Password,int Client_Id)
{
try
{
IList<UsersVM> objUsers;
IList<UsersVM> objContacts;
objUsers = Context.Users.Where(b => b.UserName == UserName && b.Password == Password && b.Client_Id == Client_Id)
.Join(Context.Members, d => d.Contacts_Id, c => c.Contact_Id, (d, c) => new { d, c })
.Join(Context.Families, e => e.c.Id, f => f.Member_Id, (e, f) => new { e, f })
.Join(Context.Brokers, h => h.f.Broker_Id, g => g.Id, (h, g)
=> new UsersVM()
{
Id = h.e.d.Id,
UserName = h.e.d.UserName,
Contact_Id = h.e.d.Contacts_Id,
Password = h.e.d.Password,
Profile_Code = h.e.d.Profile_Id,
brokerVM = new BrokersVM
{
Company = g.Company
},
FamilyVM = new FamilyVM
{
Id = h.f.Id
}
}).ToList();
objContacts = Context.Users.Where(b => b.UserName == UserName && b.Password == Password && b.Client_Id == Client_Id)
.Join(Context.Contacts, c => c.Contacts_Id, u => u.Id, (c, u) => new { c, u })
.Join(Context.Brokers, b => b.u.Id, f => f.Contacts_Id, (b, f) => new UsersVM()
{
Contact_Id = b.u.Id
}).ToList();
return objUsers;