public async Task <IActionResult> PutSubscription(string id, Subscription subscription)
        {
            if (id != subscription.Sender)
            {
                return(BadRequest());
            }

            _context.Entry(subscription).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SubscriptionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task AddAsync(string sender, string receiver)
        {
            await _littleFlowerBotContext.Subscriptions.AddAsync(new Subscription()
            {
                Sender   = sender,
                Receiver = receiver
            });

            await _littleFlowerBotContext.SaveChangesAsync();
        }