public async Task <IActionResult> EditDonation(int id, [Bind("ID,DonationItem")] Donation donation) { if (id != donation.ID) { return(NotFound()); } if (ModelState.IsValid) { try { Donation donationToEdit = await _unitOfWorkAsync.Donations.GetById(id); donationToEdit.CopyState(donation); _unitOfWorkAsync.Donations.Update(donationToEdit); _unitOfWorkAsync.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DonationExists(donation.ID)) { return(NotFound()); } else { throw; // TODO : logging } } return(RedirectToAction(nameof(DonationsTable))); } return(View(donation)); }