Exemple #1
0
        public async Task <IActionResult> DeleteConfirmed(Guid id)
        {
            Donation donation = await _donationRepository.GetDonation(id);

            if (donation == null)
            {
                return(NotFound());
            }

            try
            {
                await _donationRepository.DeleteEntity(id);

                TempData["Success"] = "Donation successfully deleted!";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                DonationVM = new DonationViewModel(donation);
                return(View(DonationVM));
            }
        }