Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. public partial class Companies
  2. {
  3. public int CompanyId { get; set; }
  4. public string Name { get; set; }
  5. public string Description { get; set; }
  6. public string Tel { get; set; }
  7. public string Logo { get; set; }
  8. public int? Owner { get; set; }
  9. public int? Address { get; set; }
  10. public int? Publish { get; set; }
  11.  
  12. public ICollection<Cars> Cars { get; set; }
  13. }
  14. public partial class Cars
  15. {
  16.  
  17. public int CarId { get; set; }
  18. public string Manufacturer { get; set; }
  19. public string Model { get; set; }
  20. public string Year { get; set; }
  21. public string Description { get; set; }
  22. public decimal? Price { get; set; }
  23. public int? CarCatId { get; set; }
  24. public int? CompanyId { get; set; }
  25. public int? CharacteristicId { get; set; }
  26.  
  27. public ICollection<CarImages> CarImages { get; set; }
  28. }
  29.  
  30. public partial class CarImages
  31. {
  32. public int CarImagesId { get; set; }
  33. public string Image { get; set; }
  34. public int? CarId { get; set; }
  35.  
  36. public Cars Car { get; set; }
  37. }
  38.  
  39. var compInfo = _context.Companies.SelectMany(cr => cr.Cars.SelectMany(i =>i.CarImages.Where(car => car.CarId == car.Car.CarId))).ToList();
  40.  
  41. var compInfo2 = _context.Companies.Include(a => a.AddressNavigation).Include(cr =>cr.Cars.).FirstOrDefault(c => c.CompanyId == id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement