src/Slugent.APIInfo/SimpleInfo/Retrievers/SimpleRetrieverAbstract.cs
/// <summary>
/// Takes an enumerable and converts it to an HTML Table
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="enums"></param>
/// <returns></returns>
Takes an enumerable and converts it to an HTML Table
Takes an enumerable and converts it to an HTML Table
protected StringBuilder ToHtmlTable<T>(IEnumerable<T> enums)
		{
			var type = typeof(T);
			var props = type.GetProperties();
			StringBuilder html = new();
			html.Append("<h1>" + Title + "</h1>");
			html.Append("<table>");
			html.Append("<thead><tr>");
			if ( props.Length == 2 ) 
				html.Append("<th>Item</th><th>Value</th>");
			else if ( props.Length == 1 ) html.Append("<th>Item</th>");
			html.Append("</tr></thead>");
			html.Append("<tbody>");
			foreach (var e in enums)
			{
				html.Append("<tr>");
				props.Select(s => s.GetValue(e)).ToList().ForEach(p => {
					html.Append("<td>" + p + "</td>");
				});
				html.Append("</tr>");
			}
			html.Append("</tbody></table>");
			return html;
		}
protected StringBuilder ToHtmlTable < T > ( IEnumerable < T > enums ) { var type = typeof ( T ) ; var props = type . GetProperties ( ) ; StringBuilder html = new ( ) ; html . Append ( " " + Title + " " ) ; html . Append ( " " ) ; html . Append ( " " ) ; if ( props . Length == 2 ) html . Append ( " " ) ; else if ( props . Length == 1 ) html . Append ( " " ) ; html . Append ( " " ) ; html . Append ( " " ) ; foreach ( var e in enums ) { html . Append ( " " ) ; props . Select ( s => s . GetValue ( e ) ) . ToList ( ) . ForEach ( p => { html . Append ( " " + p + " " ) ; } ) ; html . Append ( " " ) ; } html . Append ( " " ) ; return html ; }
Takes an enumerable and converts it to an HTML Table
Takes an enumerable and converts it to an HTML Table
// Set CSS //html.Append(header); //Header /* Do not delete - good example for converting lists, etc to tables
						foreach (var p in props)
							html.Append("<th>" + p.Name + "</th>");
						html.Append("</tr></thead>");
			*/ //Body //html.Append(ending);
None
enums
IEnumerable<T>
None
typeparam
None