In my SQL, I am joining 2 tables to collect this data, which I am getting the desired result set :
select * from [Website] as A
inner join [OrderToWebsite] as B
on A.WebsiteId = b.WebsiteId
where B.OrderId in (25, 26, 29, 32)
In my VS, I am collecting the items (25,26,29,32) via :
var orderIDs = (List<int>)Session["OrderIds"];
I am stuck writing the same T-SQL query using LINQ, I have tried so far :
IEnumerable<Website> model = from A in _db.Websites
join B in _db.OrderToWebsites
on A.WebsiteId equals B.WebsiteId
.........(Not sure how to include the orderIDs to check against...)
select B.OrderId.tolist();
This was closed earlier as repeated question, but this situation is unique and I couldn't find an answer for this type of scenario.
OrderToWebsiteiewModel.cs
public class OrderToWebsiteiewModel
{
public int OrderToWebsiteId{ get; set; }
public int OrderId { get; set; }
public int WebsiteId { get; set; }
public int CustomerAgrreementId { get; set; }
public virtual int CustomerId { get; set; }
public string CreatedBy { get; set; }
public DateTime CreatedDate { get; set; }
}
WebsiteViewModel.cs
public class WebsiteViewModel
{
public int WebsiteId { get; set; }
public string Name { get; set; }
public string URL { get; set; }
public DateTime? WebsiteAvailableBeginDate { get; set; }
public DateTime? WebsiteAvailableEndDate { get; set; }
public bool? ProposedWebsite { get; set; }
public string CreatedBy { get; set; }
public DateTime? CreatedDate { get; set; }
public string Notes { get; set; }
}
Any help is greatly appreciated.