Example #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));
        }
Example #2
0
        public CommentItem(SubscriberItem author, string text)
        {
            idCount++;

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

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

            this.id     = idCount;
            this.author = new SubscriberItem();
            this.text   = "";
        }
Example #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);
        }
Example #5
0
        public async Task RemoveSubscriber(SubscriberItem subscriber)
        {
            await _queueClient.RemoveSubscribers(new SubscriberRequestCollection
            {
                Subscribers = new List <SubscriberItem> {
                    subscriber
                }
            });

            await RefreshQueueInfo();
        }
Example #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;
        }
Example #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));
        }
Example #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);
            }
        }
Example #10
0
 public void AddToSubscriber(SubscriberItem subscriberItem)
 {
     base.AddObject("Subscriber", subscriberItem);
 }
Example #11
0
 public void AddToSubscriber(SubscriberItem subscriberItem)
 {
     base.AddObject("Subscriber", subscriberItem);
 }
Example #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;
 }
Example #13
0
 public bool HasSubscriber(SubscriberItem subscriber)
 {
     return(QueueInfo.Subscribers.Any(x => SubscriberItem.SubscriberItemComparer.Equals(x, subscriber)));
 }
Example #14
0
 public async Task ReplaceSubscribers(SubscriberItem subscriberItem)
 {
     await ReplaceSubscribers(new List <SubscriberItem> {
         subscriberItem
     });
 }