Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="imagen"></param>
        /// <returns></returns>
        public static MvcHtmlString RenderImagen(this HtmlHelper htmlHelper, string imagen, object htmlAttributes = null)
        {
            string urlImagen = htmlHelper.UrlImagen(imagen);

            var mainAttrs = new Dictionary <string, object>();

            mainAttrs.Add("src", urlImagen);

            var tagBuilder = new FluentTagBuilder("img")
                             .AddAttributes(htmlAttributes)
                             .AddAttributes(mainAttrs);

            return(tagBuilder.ToMvcHtmlString(TagRenderMode.Normal));
        }