如何使用 MVC 查看特定 ID 值的单个图像?

how to view single image with respect to particular ID value using MVC?

在我的代码中已经查看了整体图像,但我只需要显示特定 ID 值图像..

<div class="photo">
    @foreach (var imgPath in Directory.GetFiles(Server.MapPath("~/ComapnyLogo"), "*.png"))
    {
        var img = new FileInfo(imgPath);
        <img src="@Url.Content(String.Format("~/ComapnyLogo/{0}", img.Name))" />
    }
</div>

隐藏 ID

<input type="hidden" value="@ViewBag.hdnCompany" id="hdnCompany" />

public ActionResult ViewCompany()
        {
            var data = dp.Company.SqlQuery("Select * from CompanyRegistration").ToList();
            return View(data);
        }

小错误我把问题解决了

<img src="@Url.Content(String.Format("~/ComapnyLogo/" + MainModel.CompanyID + ".png"))" />

这段代码在我这边运行良好..