Can someone please help me to create a linq query.
Let's assume I have one Linq query like below and I have the database context variable is there where all Tables are exists.
var pos = _context.PurchaseOrders
.Join(_context.PODetails, poOrder=>poOrder.PurchaseOrderId, details => details.PurchaseOrderId,(poOrder, details) => new { poOrder, details })
.Where(x => x.poOrder.Status != "PO Fully Invoiced" &&` CompareDates(x.details.ExpectedInvoiceDate.Value.AddMonths(validationAfter)));
CompareDates Method code:
bool CompareDates(DateTime expected) {
var now = DateTime.Now;
return expected.Year == now.Year && expected.Month == now.Month;
}
Question: Now I want to join another table called Budget and both budget and PurchaseOrder table can join using BudgetId.BudgetId column is already present in both PurchaseOrder and Budget Table. How to join the table to get all the data and also if possible, please explain the above linq query code or give any reference to follow.