public string CreateJsonData() { var statusObject = new JObject( new JProperty("IsSuccess", IsSuccess)); if (!string.IsNullOrEmpty(ErrorText)) { statusObject.Add(new JProperty("MessageType", "warning")); statusObject.Add(new JProperty("MessageText", ErrorText.EscapeHtml())); } if (!string.IsNullOrEmpty(SuccessText)) { statusObject.Add(new JProperty("MessageType", "success")); statusObject.Add(new JProperty("MessageText", SuccessText.EscapeHtml())); } foreach (var m in _messages) { statusObject.Add(m); } return(statusObject.ToString()); }