C# 获取MVC应用程序中存储在数据库中的图像链接

C# 获取MVC应用程序中存储在数据库中的图像链接,c#,asp.net-mvc,database,image,C#,Asp.net Mvc,Database,Image,我想获取存储在数据库中的图像的url作为字节数组,以便在其他页面中使用此图像url。我的执行情况如下: 模型 控制器: public FileContentResult GetImageById(int id) { Image image = _imageRepository.GetImageById(int id); var byteArray = image.Photo; if (byteArray != null)

我想获取存储在数据库中的图像的url作为字节数组,以便在其他页面中使用此图像url。我的执行情况如下:

模型

控制器:

    public FileContentResult GetImageById(int id)
    {
        Image image = _imageRepository.GetImageById(int id);
        var byteArray = image.Photo;
        if (byteArray != null)
        {
            return new FileContentResult(byteArray, "image/jpeg");
        }
        return null;
    }
鉴于我这样做:

<img src="@Url.Action("GetImageById", "Image", new { id = item.ProductID })" alt="@item.Name" />

因此,我看到了数据库中的图像,但链接是:
我可以将其保存到磁盘,但无法共享此图像的链接。我如何设置所有内容以获取数据库中存储的以下格式的图像链接:并将此信息存储在我的模型的Url属性中,以便在上载过程中生成链接?

您是否有自定义图像路径?否,我是否必须获取一个?我应该如何定义它?
<img src="@Url.Action("GetImageById", "Image", new { id = item.ProductID })" alt="@item.Name" />