public override JObject ToJSON(Boolean Embedded = false) => JSONObject.Create( !Embedded ? new JProperty("@context", JSONLDContext.ToString()) : null, new JProperty("email", EMailAddress.ToJSON(Embedded: true)), Subject.IsNotNullOrEmpty() ? new JProperty("subject", Subject) : null, SubjectPrefix.IsNotNullOrEmpty() ? new JProperty("subjectPrefix", SubjectPrefix) : null, ListId.IsNotNullOrEmpty() ? new JProperty("listId", ListId) : null, NotificationMessageTypes.SafeAny() ? new JProperty("messageTypes", new JArray(NotificationMessageTypes.Select(msgType => msgType.ToString()))) : null, Description.IsNotNullOrEmpty() ? new JProperty("description", Description) : null );
public string PrefixSubject(string subject, int maxLength) { var result = $"{SubjectPrefix?.Trim() ?? ""} {subject}".Trim(); return(result.Length > maxLength?result.Substring(0, maxLength - 3) + "..." : result); }