Here is the controller:
public ActionResult CategoryImage(int? id) { if (id == null) { return HttpNotFound(); } CategoryGallery gallery = mc.CategoriesGallery.Include(g => g.ImagesGallery) .FirstOrDefault(g => g.Id == id); if (gallery == null) { return HttpNotFound(); } return PartialView(gallery); } src="image.ImageUrl.ToString()" returns a lot of images, it works without ToString()
src="image.ImageUrl.FirstOrDefault()" returns an empty string ... FirstOrDefault(i => i.CategoryGalleryId == Model.Id) - this option is also empty ...
I tried various variations, but I haven’t got the desired result yet ... Is this possible with the current data model?
CategoriesGalleryentity that has a lot ofImagesGallery, and you want to choose one category and one picture for it? - teranInclude(g => g.ImagesGallery.FirstOrDefault() )? - teran