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()); }
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(); } }