public async Task <ActionResult <CommentItem> > PostSubscriberItem(SubscriberItem item) { subscriberContext.SubscriberItems.Add(item); await subscriberContext.SaveChangesAsync(); return(CreatedAtAction(nameof(GetSubscriberItem), new { number = item.number }, item)); }
public CommentItem(SubscriberItem author, string text) { idCount++; this.id = idCount; this.author = author; this.text = text; }
public string text; // Actual comment // Constructors public CommentItem() { idCount++; this.id = idCount; this.author = new SubscriberItem(); this.text = ""; }
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); }
public async Task RemoveSubscriber(SubscriberItem subscriber) { await _queueClient.RemoveSubscribers(new SubscriberRequestCollection { Subscribers = new List <SubscriberItem> { subscriber } }); await RefreshQueueInfo(); }
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; }
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)); }
// 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); } }
public void AddToSubscriber(SubscriberItem subscriberItem) { base.AddObject("Subscriber", subscriberItem); }
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; }
public bool HasSubscriber(SubscriberItem subscriber) { return(QueueInfo.Subscribers.Any(x => SubscriberItem.SubscriberItemComparer.Equals(x, subscriber))); }
public async Task ReplaceSubscribers(SubscriberItem subscriberItem) { await ReplaceSubscribers(new List <SubscriberItem> { subscriberItem }); }