public ActionResult EventoDetalhe(int id) { Evento e = eventoRepositorio.GetEvento(id); if (e != null) { PontoFormViewModel pfvm = ((PontoFormViewModel)Session["PontoFormViewModel"]); pfvm.EventoDetalhe = e; return(View("EventoDetalhe", pfvm)); } return(View("NaoEncontrado")); }
public ActionResult ThumbImageEvento(int id, int width, int height, string tipo) { var evento = eventoRepositorio.GetEvento(id); Image i = null; try { if (tipo.Equals("P") || tipo.Equals("p")) { byte[] tempImage = evento.ImagemPequena.ToArray(); i = Image.FromStream(new MemoryStream(tempImage)); } else if (tipo.Equals("M") || tipo.Equals("m")) { byte[] tempImage = evento.ImagemMedia.ToArray(); i = Image.FromStream(new MemoryStream(tempImage)); } else if (tipo.Equals("G") || tipo.Equals("g")) { byte[] tempImage = evento.ImagemGrande.ToArray(); i = Image.FromStream(new MemoryStream(tempImage)); } //Stream. stream = new Stream(); return(new ImageResult(i, width, height)); } catch (Exception ex) { i = new Bitmap(1, 1); return(new ImageResult(i, 1, 1)); } finally { if (i != null) { i.Dispose(); } } }