Пример #1
0
        public ActionResult GetImage(int id)
        {
            // fetch image data from database
            try
            {
                var evento = _eventoServicio.ObtenerPorId(id);

                return(File(evento.Imagen, "image/jpg"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Пример #2
0
        public ActionResult GetImage(int id)
        {
            // fetch image data from database

            try
            {
                if (Session["Usuario"] != null)
                {
                    var evento = _eventoServicio.ObtenerPorId(id);

                    return(File(evento.Imagen, "image/jpg"));
                }
                else
                {
                    return(RedirectToAction("Login", "Usuario"));
                }
            }
            catch (Exception e)
            {
                ViewBag.ErrorEvento = "Cargar una imagen para su evento";
                return(RedirectToAction("Crear", "Evento"));
            }
        }