public ActionResult Edit(int id)
        {
            Noticia noticia = noticiaRepositorio.GetNoticia(id);

            if (noticia != null)
                return View(noticia);
            return View("NaoEncontrado");
        }
        public ActionResult NoticiaDetalhe(int id)
        {
            Noticia n = noticiaRepositorio.GetNoticia(id);

            if (n != null)
            {
                PontoFormViewModel pfvm = ((PontoFormViewModel)Session["PontoFormViewModel"]);
                pfvm.NoticiaDetalhe = n;
                return(View("NoticiaDetalhe", pfvm));
            }
            return(View("NaoEncontrado"));
        }
Esempio n. 3
0
        public ActionResult ThumbImageNoticia(int id, int width, int height, string tipo)
        {
            var   noticia = noticiaRepositorio.GetNoticia(id);
            Image i       = null;

            try
            {
                if (tipo.Equals("P") || tipo.Equals("p"))
                {
                    byte[] tempImage = noticia.ImagemPequena.ToArray();

                    i = Image.FromStream(new MemoryStream(tempImage));
                }
                else if (tipo.Equals("M") || tipo.Equals("m"))
                {
                    byte[] tempImage = noticia.ImagemMedia.ToArray();

                    i = Image.FromStream(new MemoryStream(tempImage));
                }
                else if (tipo.Equals("G") || tipo.Equals("g"))
                {
                    byte[] tempImage = noticia.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();
                }
            }
        }