Beispiel #1
0
            public override CommandResponse Handle(ClearQueue cmd)
            {
                var queueItems = _db
                                 .Query <QueueItem>()
                                 .ToList();

                queueItems.ForEach(x => _db.Delete(x));

                _db.Commit();
                _pusher.NotifyQueueItemsChanged();

                return(CommandResponse.Success());
            }
Beispiel #2
0
            public override CommandResponse Handle(DeleteQueueItem cmd)
            {
                var queueItem = _db
                                .Query <QueueItem>()
                                .Single(x => x.Id == cmd.Id);

                _db.Delete(queueItem);
                _db.Commit();

                _pusher.NotifyQueueItemsChanged();

                return(CommandResponse.Success());
            }
Beispiel #3
0
            public override CommandResponse Handle(SetQueueItemLog cmd)
            {
                if (cmd.ItemIds == null || cmd.ItemIds.Length < 1)
                {
                    return(CommandResponse.Error("No items selected"));
                }

                var queueItems = _db
                                 .Query <QueueItem>()
                                 .Where(x => cmd.ItemIds.Contains(x.Id))
                                 .ToArray();

                foreach (var queueItem in queueItems)
                {
                    queueItem.Log = cmd.Log;
                }

                _db.Commit();
                _pusher.NotifyQueueItemsChanged();

                return(CommandResponse.Success());
            }
Beispiel #4
0
 public void OnCreating(CreatingContext filterContext)
 {
     _pusher.NotifyQueueItemsChanged();
 }