public IHttpActionResult GetNotificationTemplate(string type, string objectId, string objectTypeId, string language) { NotificationTemplate retVal = new NotificationTemplate(); var criteria = new GetNotificationCriteria() { Type = type, ObjectId = objectId, ObjectTypeId = objectTypeId, Language = language }; var notification = _notificationManager.GetNewNotification(criteria); if (notification != null) { retVal = notification.NotificationTemplate; } return Ok(retVal.ToWebModel()); }
public IHttpActionResult PrepareTest(string type) { var criteria = new GetNotificationCriteria() { Type = type }; var notification = _notificationManager.GetNewNotification(criteria); var retVal = _notificationTemplateResolver.ResolveNotificationParameters(notification); return Ok(retVal.Select(s => s.ToWebModel()).ToArray()); }
public IHttpActionResult SendNotification([FromBody]List<KeyValuePair<string, string>> parameters, string type, string objectId, string objectTypeId, string language) { var criteria = new GetNotificationCriteria() { Type = type, ObjectId = objectId, ObjectTypeId = objectTypeId, Language = language }; var notification = _notificationManager.GetNewNotification(criteria); foreach (var param in parameters) { var property = notification.GetType().GetProperty(param.Key); property.SetValue(notification, param.Value); } var result = _notificationManager.SendNotification(notification); return Ok(result.ErrorMessage); }
public IHttpActionResult ResolveNotification([FromBody]List<KeyValuePair<string, string>> parameters, string type, string objectId, string objectTypeId, string language) { var criteria = new GetNotificationCriteria() { Type = type, ObjectId = objectId, ObjectTypeId = objectTypeId, Language = language }; var notification = _notificationManager.GetNewNotification(criteria); foreach (var param in parameters) { var property = notification.GetType().GetProperty(param.Key); property.SetValue(notification, param.Value); } _notificationTemplateResolver.ResolveTemplate(notification); return Ok(notification.ToWebModel()); }