I'm trying to make an e-commerce web app where during uploading an ad, you can add multiple photos. During uploading the photos to Database, they're getting assigned a value of product id those photos represents. My issue is that i don't know how to display only the photos with correlating id value, so the view of product with id = 2, only shows the photos with this id assigned.
Also I don't know how to make those photos appear as a carousel instead of list of photos.
Below is the code.
View
<div class="pro_image_container">
<div class="pro_image">
@foreach (var image in Model.pro_img_path)
{
<img src="@Url.Content(image)" />
}
</div>
</div>
Model
public IEnumerable<string> pro_img_path { get; set; }
public int? pro_img_fk_pro_id { get; set; }
public int? pro_img_id { get; set; }
Controller
ad.pro_img_path = Directory.EnumerateFiles(Server.MapPath("~/Content/user_upload/")).Select(fn => "~/Content/user_upload/" + Path.GetFileName(fn));
var objfile = new DirectoryInfo(Server.MapPath("~/Content/user_upload/"));
var file = objfile.GetFiles("*.*");
return View(ad);
Thank you in advance