using System.Text; using PdfService.Models; namespace PdfService.Utility { public static class TemplateGenerator { public static string GetHTMLString(Term[] terms) { var sb = new StringBuilder(); sb.Append(@"

Tweet Sentiment Analysis

Results for the terms

"); foreach (Term term in terms) { string color = ""; if(term.Sentiment < 0.40) color = "is-danger"; else if(term.Sentiment < 0.60) color = "is-warning"; else color = "is-success"; sb.AppendFormat(@"

{0} (value: {3})

Sentiment Analysis Result:
{1}%
", term.Name, System.Math.Ceiling(term.Sentiment*100), color, term.Sentiment); } sb.Append(@"
"); return sb.ToString(); } } }