Guest User

Guest User

  • Tech Writer
  • 611
  • 129.3k

Get List consume time

Nov 12 2020 12:17 AM
I have get data from two table using join in linq c# and show a data list in front end .But its very consume time
I want to not time consume
 
it's me code
  1. var Result = (from UM in _context.UserP  
  2. join C in _context.ContactUs on UM.UserId equals C.UserId  
  3. where UM.UserId == C.UserId  
  4. select new  
  5. {  
  6. UM.UserImage,  
  7. C.Name,  
  8. C.UpdatedDate,  
  9. C.Email,  
  10. C.Message,  
  11. C.ContactUsId  
  12. }).ToList();  
  13. if (Result.Count > 0)  
  14. {  
  15. foreach (var item in Result.OrderByDescending(t => t.Name).ToList())  
  16. {  
  17. ReportManagementViewModel obj = new ReportManagementViewModel();  
  18. obj.UserName = item.Name;  
  19. obj.Email = item.Email;  
  20. DateTime aDate = Convert.ToDateTime(item.UpdatedDate);  
  21. obj.Date = aDate.ToString("MMMM dd, yyyy");  
  22. obj.Message = item.Message;  
  23. obj.UserImage = item.UserImage;  
  24. obj.ContactUsId = item.ContactUsId;  
  25. List.Add(obj);  

Answers (1)