Guest User

Guest User

  • Tech Writer
  • 611
  • 127.8k

Get only Matching record.

Sep 28 2020 5:02 AM
I have get record from three table using linq c# .it's working fine but i have face issue i want to get record based on id and status .I have use this query
  1. var Fav = (from FV in _context.TblFavUserVideo  
  2. join VM in _context.TblVideoMaster on FV.FileId equals VM.FileId into VMs  
  3. from VM in VMs.DefaultIfEmpty()  
  4. join EV1 in _context.TblEducationalVideo on FV.EducationalImageId equals EV1.EducationalId into EV1s  
  5. from EV1 in EV1s.DefaultIfEmpty()  
  6. join EV in _context.TblEducationalVideo on FV.EducationalVideoId equals EV.EducationalId into EVs  
  7. from EV in EVs.DefaultIfEmpty()  
  8. where FV.UserId == obj_parameter.UserId && FV.IsFav== obj_parameter.Status || VM.VideoFavStatus == true || FV.SubCategoryVideoFavStatus == true || FV.EdcuationalImageStatus == true || FV.EdcuationalVideoStatus == true  
  9. select new  
  10. {  
  11. FV.FavId,  
  12. FV.IsFav,  
  13. FV.UserId,  
  14. FV.SubCategoryVideoFavStatus,  
  15. FV.EdcuationalVideoStatus,  
  16. FV.EdcuationalImageStatus,  
  17. FV.UpdatedDate,  
  18. VM.FilePath,  
  19. VM.VideoTitle,  
  20. VM.VideoDescription,  
  21. EV.Title,  
  22. EV.Description,  
  23. EV1.ImagePath,  
  24. ImageTitle = EV1.Title,  
  25. Desc = EV1.Description,  
  26. EV.EducationalId,  
  27. EV.VideoPath  
  28. }).ToList();  
  29. I will send  
  30. {  
  31. "UserId":37,  
  32. "Status":1  
  33. }  
this param .But here all record showing for e.g total 80 record in my table loop are 80 time run.So my api very late response .Please resolve this issue

Answers (2)