Click here to Skip to main content
15,918,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to ASP.CORE and I want to Convert this statement from T-SQL using the CORE context


SQL
SELECT ID, SchemeCode, Name 
FROM   Scheme SM                
WHERE 
    SM.ParentID = 1             
AND sm.[ID] 
          IN (SELECT dd.[Scheme_id]
               FROM  dbo.[Employer_Detail] dd 
               INNER JOIN dbo.[Employer] er 
               ON dd.Employer_id = er.Employer_id
               WHERE er.Employer_Parent_id = 123


What I have tried:

I haven't tried anything as I am new to Core and don't know where to start.
Posted
Updated 4-Dec-19 21:23pm

Quote:
I haven't tried anything as I am new to Core and don't know where to start
Start here: Introduction to ASP.NET Core | Microsoft Docs[^]
Then start working your way through some tutorials e.g. Get started with ASP.NET Core MVC | Microsoft Docs[^]
Other tutorials are available on line[^]

It sounds as if you are some way off from needing that SQL embedded in any code.
 
Share this answer
 
Comments
Member 14142520 5-Dec-19 0:46am    
Don't you think that I have been through the tutorials before I came here to ask this?
Solved
var npSchemes = from scheme in _context.Schemes
               join ded in _context.DeductionCodes on scheme.Id 
               equals ded.SchemeId
               join er in _context.Employers on ded.EmployerId 
               equals er.Id
               where scheme.ParentId == parentId 
               && er.ParentId == employerId
               select new {scheme.Id, scheme.Code, scheme.Name};
               var result = npSchemes.GroupBy(sm => sm.Id).Select(grp =>
               grp.First()).ToList();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900