Hello guys,
I created a controller and a view, to fetch data from my database an image, which is in blob format. However, the image is not loaded in the view (I call a method to call this view).
I have the controller Image (with the GetImage method), the ReadyDrive controller and the ReadyDelivery view. Within the ReadyDate view, I pass the parameter to get the ID in the GetImage method.
Controller Imagem:
- public ActionResult Index()
- {
- return View();
- }
- public ActionResult GetImagem(int id)
- {
- Entities1 tabela = new Entities1();
- byte[] BlobImg = tabela.DATABINARY.Where(p => p.ID.Equals(id)).Select(p => p.DATA).FirstOrDefault();
- return File(BlobImg, "image/png");
- }
Controller ProntaEntrega
- public ActionResult Index(int? reduzido=null)
- {
- Entities1 Estoque = new Entities1();
- List
ProntaE = (from a in Estoque.V500_ESTOQUE_PE_WEB select a).OrderByDescending(x => x.TOTAL_KG_PE).ToList() - .Where(x => reduzido != null ? x.COD_REDUZIDO.Equals(reduzido) : true).ToList();
- return View(ProntaE);
- }
-
- @foreach (var item in Model)
- {
class="text-left" width="30%"> - @Html.DisplayFor(d => item.COD_REDUZIDO)
class="text-left"> - @Html.DisplayFor(d => item.DESC_ARTIGO)
class="text-right"> - @Html.DisplayFor(d => item.TOTAL_KG_PE)
"@Url.Action("GetImage", "Imagem", new { id = @item.IDBLOB})" width=50 />
- }
Any help me?
Thanks!
Cleiton LimasPosted Jan 5, 2018, 12:35 PM
Nilesh ShahPosted Jan 5, 2018, 9:25 AM