📅  最后修改于: 2022-03-11 14:56:59.205000             🧑  作者: Mango
public FileStreamResult RenderImage(int id)
{
MemoryStream ms = null ;
var item = db.Products.FirstOrDefault(p => p.ProductID == id);
if (item != null)
{
ms = new MemoryStream(item.Image);
}
return new FileStreamResult(ms, item.ImageType);
}