コード例 #1
0
        public async Task <IActionResult> PutDonation(int id, Donation donation)
        {
            if (id != donation.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task ConsumeAsync(CharityActionUpdatedEvent message)
        {
            var charityActionToUpdate = await _context.CharityActions
                                        .FirstOrDefaultAsync(c => c.CharityActionKey == message.CharityActionKey);

            if (charityActionToUpdate != null)
            {
                _context.Entry(charityActionToUpdate).CurrentValues.SetValues(message);

                await _context.SaveChangesAsync();
            }
        }