public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request,
            NotificationInputModel notificationModel)
        {
            if (notificationModel != null && this.ModelState.IsValid)
            {
                var notification = Mapper.Map<Notification>(notificationModel);
                this.Data.Notifications.Update(notification);
                this.Data.SaveChanges();
            }

            return this.Json(new[] { notificationModel }.ToDataSourceResult(request, this.ModelState));
        }
        public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request,
                                                 NotificationInputModel notificationModel)
        {
            if (notificationModel != null && this.ModelState.IsValid)
            {
                var notification = Mapper.Map <Notification>(notificationModel);
                this.Data.Notifications.Update(notification);
                this.Data.SaveChanges();
            }

            return(this.Json(new[] { notificationModel }.ToDataSourceResult(request, this.ModelState)));
        }
        public ActionResult Create(NotificationInputModel notification)
        {
            if (ModelState.IsValid)
            {
                var newNotification = new Notification()
                {
                    SenderId = this.UserProfile.Id,
                    ReceiverId = notification.RecieverId,
                    ContestId = notification.ContestId,
                };

                this.Data.Notifications.Add(newNotification);

                this.Data.SaveChanges();
            }
            return new EmptyResult();
        }
        public async Task <ResponseViewModel> SendNotification(NotificationInputModel notification)
        {
            using (var sender = new Sender(_setting.FireBaseSenderKey))
            {
                var message = new FCM.Net.Message
                {
                    RegistrationIds = notification.RegistrationIds,

                    Notification = notification.Notification
                };

                var result = await sender.SendAsync(message);

                Console.WriteLine($"Success: {result.MessageResponse.Success}");

                //var json = "{\"notification\":{\"title\":\"json message\",\"body\":\"works like a charm!\"},\"to\":\"" + registrationId + "\"}";
                //result = await sender.SendAsync(json);
                //Console.WriteLine($"Success: {result.MessageResponse.Success}");
            }

            return(ResponseViewModel.Ok());
        }