Exemplo n.º 1
0
        // To convert the Byte Array to the author Image
        public FileContentResult getUserImg(String userId)
        {
            String        tienda = Session["Tienda_Nombre"].ToString();
            ImagenUsuario iu     = uC.ObtenerImagenUsuario(userId, tienda);

            if (iu != null)
            {
                byte[] byteArray = iu.Imagen;
                return(byteArray != null
                 ? new FileContentResult(byteArray, "image/jpeg")
                 : null);
            }
            else
            {
                var dir  = Server.MapPath("~/Content/Images");
                var path = Path.Combine(dir, "user_sin_imagen.png");
                return(new FileContentResult(System.IO.File.ReadAllBytes(path), "image/jpeg"));
            }
        }