When using LINQ, there has a Union method, you can use it to produce the set union of two sequences. Refer to the following code:
var result1 = _context.Dsales.Where(c => c.id <3).Union(_context.Dsales.Where(c => c.id>4)).ToList();
The result as below:
Note: in my sample, I'm using the same database and table, from your code, it seems that you are using multiple database, if that is the case, you might need to use the select
clause to convert to the data type to vDsales
first (Code like this: _context.Dsales.Where(c => c.id <3).Select(c=> new vDsales(){ ...})
), then use the Union method.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion