Skip to content

Commit

Permalink
Merge pull request #459 from JefStat/scratchingAnItch
Browse files Browse the repository at this point in the history
Replace if statements with function
  • Loading branch information
thinkingserious authored May 17, 2017
2 parents 56f7098 + 4ee3635 commit 8862019
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/SendGrid/Helpers/Mail/MailHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public static SendGridMessage CreateSingleEmail(
var msg = new SendGridMessage();
msg.SetFrom(from);
msg.SetSubject(subject);
if (plainTextContent != null && plainTextContent != string.Empty)
if (!string.IsNullOrEmpty(plainTextContent))
{
msg.AddContent(MimeType.Text, plainTextContent);
}

if (htmlContent != null && htmlContent != string.Empty)
if (!string.IsNullOrEmpty(htmlContent))
{
msg.AddContent(MimeType.Html, htmlContent);
}
Expand Down Expand Up @@ -71,12 +71,12 @@ public static SendGridMessage CreateSingleEmailToMultipleRecipients(
var msg = new SendGridMessage();
msg.SetFrom(from);
msg.SetGlobalSubject(subject);
if (plainTextContent != null && plainTextContent != string.Empty)
if (!string.IsNullOrEmpty(plainTextContent))
{
msg.AddContent(MimeType.Text, plainTextContent);
}

if (htmlContent != null && htmlContent != string.Empty)
if (!string.IsNullOrEmpty(htmlContent))
{
msg.AddContent(MimeType.Html, htmlContent);
}
Expand Down Expand Up @@ -109,12 +109,12 @@ public static SendGridMessage CreateMultipleEmailsToMultipleRecipients(
{
var msg = new SendGridMessage();
msg.SetFrom(from);
if (plainTextContent != null && plainTextContent != string.Empty)
if (!string.IsNullOrEmpty(plainTextContent))
{
msg.AddContent(MimeType.Text, plainTextContent);
}

if (htmlContent != null && htmlContent != string.Empty)
if (!string.IsNullOrEmpty(htmlContent))
{
msg.AddContent(MimeType.Html, htmlContent);
}
Expand Down

0 comments on commit 8862019

Please sign in to comment.