Пример #1
0
        public static HtmlString ExibirEntidadeColorCodedComNomePersonalizado(this IColorCoded entidade, string texto, string elemento = "p", string imgclass = "img-thumbnail rounded float-left")
        {
            List <KeyValuePair <string, string> > ConteudoStyles = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("border-bottom", $"3px solid {entidade.Color}")
            };

            string ConteudoStyle = CreateHTMLStyle(ConteudoStyles);
            string Conteudo      = AninharEmElemento(elemento, texto, CreateHTMLProperty("class", "card-body instituicao-title") + ConteudoStyle);
            string HrefConteudo  = AninharEmElemento("a", Conteudo);
            string Img           = string.Empty;

            if (entidade.Logo != null)
            {
                List <KeyValuePair <string, string> > ImageProperties = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("class", $"{imgclass}"),
                    new KeyValuePair <string, string>("src", $"data:image;base64,{Convert.ToBase64String(entidade.Logo)}")
                };
                Img = HTMLElements.Img(CreateHTMLProperties(ImageProperties));
            }

            string     DivClasse  = CreateHTMLProperty("class", CSSCustomClassNames.InstituicaoDiv());
            string     Properties = DivClasse;
            string     Elemento   = AninharEmDiv(Img + HrefConteudo, Properties);
            HtmlString html       = new HtmlString(Elemento);

            return(html);
        }
Пример #2
0
        public static HtmlString ExibirEntidadeColorCodedSemImagem(this IColorCoded entidade, string elemento = "p")
        {
            List <KeyValuePair <string, string> > ConteudoStyles = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("border-bottom", $"3px solid {entidade.Color}")
            };

            string ConteudoStyle = CreateHTMLStyle(ConteudoStyles);
            string Conteudo      = AninharEmElemento(elemento, entidade.Nome, CreateHTMLProperty("class", "card-body instituicao-title") + ConteudoStyle);
            string HrefConteudo  = AninharEmElemento("a", Conteudo);

            string     DivClasse  = CreateHTMLProperty("class", CSSCustomClassNames.InstituicaoDiv());
            string     Properties = DivClasse;
            string     Elemento   = AninharEmDiv(HrefConteudo, Properties);
            HtmlString html       = new HtmlString(Elemento);

            return(html);
        }