Beispiel #1
0
 public async Task <IActionResult> CreateAsync([FromBody] MessageItem item)
 {
     if (item == null)
     {
         return(BadRequest());
     }
     foreach (var token in _context.TokenItems.Where(x => x.Email == item.Email))
     {
         var message = FirebaseService.GetMessage(token, item);
         await FirebaseService.FCMClient.SendMessageAsync(message);
     }
     _context.MessageItem.Add(item);
     _context.SaveChanges();
     return(CreatedAtRoute("GetToken", new { id = item.Id }, item));
 }