public async Task <IActionResult> SendNotification([FromBody] Notification newNotification) { HubResponse <NotificationOutcome> pushDeliveryResult = await _notificationHubProxy.SendNotification(newNotification); if (pushDeliveryResult.CompletedWithSuccess) { return(Ok()); } return(BadRequest("An error occurred while sending push notification: " + pushDeliveryResult.FormattedErrorMessages)); }
public async Task <IActionResult> SendNotification() { var notification = new Notification() { Content = "{\"notification\":{\"title\":\"Notification Hub Test Notification\"," + "\"body\":\"This is a sample notification delivered by Azure Notification Hubs.\"}" + ",\"data\":{\"property1\":\"value1\",\"property2\":42}}" }; HubResponse <NotificationOutcome> pushDeliveryResult = await _notificationHubProxy.SendNotification(notification); if (pushDeliveryResult.CompletedWithSuccess) { return(Ok()); } return(BadRequest("An error occurred while sending push notification: " + pushDeliveryResult.FormattedErrorMessages)); }