public IHttpActionResult RenderNotificationContent(webModels.TestNotificationRequest request) { var retVal = new webModels.RenderNotificationContentResult(); var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language); foreach (var param in request.NotificationParameters) { var property = notification.GetType().GetProperty(param.Key); var jObject = param.Value as Newtonsoft.Json.Linq.JObject; if (jObject != null) { property.SetValue(notification, jObject.ToObject <Dictionary <string, string> >()); } else { property.SetValue(notification, param.Value); } } _eventTemplateResolver.ResolveTemplate(notification); retVal.Subject = notification.Subject; retVal.Body = notification.Body; return(Ok(retVal)); }
public IHttpActionResult SendNotification(webModels.TestNotificationRequest request) { var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language); foreach (var param in request.NotificationParameters) { SetValue(notification, param); } var result = _notificationManager.SendNotification(notification); return(Ok(result)); }
public IHttpActionResult RenderNotificationContent(webModels.TestNotificationRequest request) { var retVal = new webModels.RenderNotificationContentResult(); var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language); foreach (var param in request.NotificationParameters) { SetValue(notification, param); } _eventTemplateResolver.ResolveTemplate(notification); retVal.Subject = notification.Subject; retVal.Body = notification.Body; return(Ok(retVal)); }
public IHttpActionResult SendNotification(webModels.TestNotificationRequest request) { var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language); foreach (var param in request.NotificationParameters) { var property = notification.GetType().GetProperty(param.Key); var jObject = param.Value as Newtonsoft.Json.Linq.JObject; if (jObject != null) { property.SetValue(notification, jObject.ToObject <Dictionary <string, string> >()); } else { property.SetValue(notification, param.Value); } } var result = _notificationManager.SendNotification(notification); return(Ok(result.ErrorMessage)); }