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.33) color = "is-danger"; else if(term.Sentiment < 0.66) color = "is-warning"; else color = "is-success"; sb.AppendFormat(@"

{0}

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