Ejemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] PushNotificationModel model)
        {
            _logger.LogDebug("Post Called!!!");
            var email = this.User.Claims.FirstOrDefault(p => p.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress")?.Value;

            if (email == null)
            {
                email = this.User.Claims.FirstOrDefault(p => p.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value;
            }

            var pushmessage = new PushNotificationPayloadModel
            {
                Title   = "Push Notification registered",
                Email   = email,
                Message = "Welcome"
            };

            List <Task> tasks = new List <Task>();
            var         task1 = _pushNotificationService.NewUserAsync(email, model);
            var         task2 = _pushNotificationService.PushNotification(model, pushmessage);

            tasks.Add(task1);
            tasks.Add(task2);
            Task.WaitAll(tasks.ToArray());
            return(Created("", null));
        }
Ejemplo n.º 2
0
        public IActionResult Post([FromBody] PushNotificationModel model, [FromHeader] string Email)
        {
            _logger.LogDebug("Post Called");
            var iden  = this.User.Identity;
            var email = this.User.Claims.FirstOrDefault(p => p.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value;

            //TODO: Implement Realistic Implementation
            model.Email = Email;
            var payload = JsonConvert.SerializeObject(
                new
            {
                Email   = Email,
                Message = "Welcome",
                Link    = "null"
            }
                );

            Debug.WriteLine(payload);

            NofityUser(model.Endpoint, model.Keys.P256dh, model.Keys.Auth, payload);
            return(Created("", null));
        }
Ejemplo n.º 3
0
 public IActionResult JustforUsers([FromBody] PushNotificationModel model, [FromHeader] string Email)
 {
     return(Content("Ok"));
 }
Ejemplo n.º 4
0
 public IActionResult JustforUsers([FromBody] PushNotificationModel model)
 {
     return(Content("Ok"));
 }