예제 #1
0
        public async Task <ActionResult <CommentItem> > PostSubscriberItem(SubscriberItem item)
        {
            subscriberContext.SubscriberItems.Add(item);
            await subscriberContext.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetSubscriberItem), new { number = item.number }, item));
        }
예제 #2
0
        public CommentItem(SubscriberItem author, string text)
        {
            idCount++;

            this.id     = idCount;
            this.author = author;
            this.text   = text;
        }
예제 #3
0
        public string text;             // Actual comment

        // Constructors
        public CommentItem()
        {
            idCount++;

            this.id     = idCount;
            this.author = new SubscriberItem();
            this.text   = "";
        }
예제 #4
0
        public static SubscriberItem CreateSubscriberItem(int ID, byte[] rowVersion, string firstName, string lastName)
        {
            SubscriberItem subscriberItem = new SubscriberItem();

            subscriberItem.Id         = ID;
            subscriberItem.RowVersion = rowVersion;
            subscriberItem.FirstName  = firstName;
            subscriberItem.LastName   = lastName;
            return(subscriberItem);
        }
예제 #5
0
        public async Task RemoveSubscriber(SubscriberItem subscriber)
        {
            await _queueClient.RemoveSubscribers(new SubscriberRequestCollection
            {
                Subscribers = new List <SubscriberItem> {
                    subscriber
                }
            });

            await RefreshQueueInfo();
        }
예제 #6
0
        public async Task <IActionResult> PutSubscriberItem(int number, SubscriberItem item)
        {
            if (number != item.number)
            {
                return(BadRequest());
            }

            subscriberContext.Entry(item).State = EntityState.Modified;
            await subscriberContext.SaveChangesAsync();

            return(NoContent());
        }
        public void Subscribe <T>(string dataSourceItemId, Action <ChangeType, object> action)
        {
            if (items.ContainsKey(dataSourceItemId))
            {
                items.Remove(dataSourceItemId);
            }

            var si = new SubscriberItem();

            si.DataSourceItemId = dataSourceItemId;
            si.ConvertToType    = typeof(T);
            si.ActionLambda     = action;

            items[dataSourceItemId] = si;
        }
예제 #8
0
        public IActionResult Send()
        {
            var lst = _context.Subscribers.ToList();
            List <SubscriberItem> model = new List <SubscriberItem>();

            for (int i = 0; i < lst.Count; i++)
            {
                SubscriberItem item = new SubscriberItem
                {
                    Name      = lst[i].Name,
                    Email     = lst[i].Email,
                    Ischecked = false
                };
                model.Add(item);
            }
            return(View(model));
        }
예제 #9
0
        // Add a comment on the book
        public bool AddComment(SubscriberItem subscriber, string text)
        {
            if (text != null)
            {
                this.comments[commentIndex] = new CommentItem(subscriber, text);

                commentIndex++;
                if (this.commentIndex == COMMENT_NUMBER)
                {
                    commentIndex = 0;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #10
0
 public void AddToSubscriber(SubscriberItem subscriberItem)
 {
     base.AddObject("Subscriber", subscriberItem);
 }
예제 #11
0
 public void AddToSubscriber(SubscriberItem subscriberItem)
 {
     base.AddObject("Subscriber", subscriberItem);
 }
예제 #12
0
 public static SubscriberItem CreateSubscriberItem(int ID, byte[] rowVersion, string firstName, string lastName)
 {
     SubscriberItem subscriberItem = new SubscriberItem();
     subscriberItem.Id = ID;
     subscriberItem.RowVersion = rowVersion;
     subscriberItem.FirstName = firstName;
     subscriberItem.LastName = lastName;
     return subscriberItem;
 }
예제 #13
0
 public bool HasSubscriber(SubscriberItem subscriber)
 {
     return(QueueInfo.Subscribers.Any(x => SubscriberItem.SubscriberItemComparer.Equals(x, subscriber)));
 }
예제 #14
0
 public async Task ReplaceSubscribers(SubscriberItem subscriberItem)
 {
     await ReplaceSubscribers(new List <SubscriberItem> {
         subscriberItem
     });
 }