Может кто-нибудь помочь мне, как написать ниже SQL запрос с помощью LINQ?
select
SubProcess.OrderNumber
,SubProcess.SubProcesName
,zProcessStatus.StatusNameDari
,ProcessProgress.Remarks
,SubProcess.TimelineInDays
,SubProcessStatus.CompletionFlag
from Process
left join SubProcess on Process.ProcessID = SubProcess.ProcessID
left join ProcessProgress on SubProcess.SubProcessID=ProcessProgress.SubProcessID
left join school on ProcessProgress.SchoolID=School.SchoolID
left join zProcessStatus on ProcessProgress.ProcessStatusID=zProcessStatus.ProcessStatusID
left join SubProcessStatus on SubProcess.SubProcessID=SubProcessStatus.SubProcessID and ProcessProgress.ProcessStatusID=SubProcessStatus.ProcessStatusID
order by SubProcess.OrderNumber
Я написал его, как показано ниже, но проблема в том, что я не знаю, как использовать оператор AND и OPERATOR как я использовал с join в запросе SQL
(from process in _applicationContext.Process
join subProcess in _applicationContext.SubProcess on process.ProcessId equals subProcess.ProcessId into processgroup
from a in processgroup.DefaultIfEmpty()
join processProgress in _applicationContext.ProcessProgress on a.SubProcessId equals processProgress.SubProcessId into processProgressGroup
from b in processProgressGroup.DefaultIfEmpty()
join school in _applicationContext.School on b.SchoolId equals school.SchoolId into schoolGroup
from c in schoolGroup.DefaultIfEmpty()
join zProcessStatus in _applicationContext.ZProcessStatus on b.ProcessStatusId equals zProcessStatus.ProcessStatusId into zProcessStatusGroup
from d in zProcessStatusGroup.DefaultIfEmpty()
join subProcessStatus in _applicationContext.SubProcessStatus on a.SubProcessId equals subProcessStatus.SubProcessId into subProcessStatusGroup
from e in subProcessStatusGroup.DefaultIfEmpty()
where process.ProcessId == id && c.SchoolId==schoolid
orderby a.OrderNumber
select new SubProcessViewModel
{
SubProcessId =a.SubProcessId,
ProcessId=process.ProcessId,
ProcessName=process.ProcessName,
SubProcesName =a.SubProcesName,
SubProcesNameDari=a.SubProcesNameDari,
OrderNumber =a.OrderNumber,
TimelineInDays=a.TimelineInDays,
ProcessStatusName = d.StatusName,
ProcessStatusNameDari=d.StatusNameDari,
CompletionFlag = e.CompletionFlag,
Remarks=b.Remarks,
}).ToList();