public async Task <DonationCandidateDTO> Save(DonationCandidateDTO donationCandidateDTO)
        {
            var donationCandidate = _mapper.Map <DonationCandidate>(donationCandidateDTO);
            var candidateInDb     = await _donationCandidateRepository.Add(donationCandidate);

            return(_mapper.Map <DonationCandidateDTO>(candidateInDb));
        }
        public async Task <ActionResult> Update(int id, DonationCandidateDTO donationCandidate)
        {
            if (id != donationCandidate.Id)
            {
                return(BadRequest());
            }

            var candidateUpdated = await _donationCandidateService.Update(id, donationCandidate);

            return(Ok(candidateUpdated)); // return NoContent
        }
        public async Task <DonationCandidateDTO> Update(int id, DonationCandidateDTO donationCandidate)
        {
            var candidateInDb = await _donationCandidateRepository.GetById(id);

            candidateInDb.FullName   = donationCandidate.FullName;
            candidateInDb.Mobile     = donationCandidate.Mobile;
            candidateInDb.Email      = donationCandidate.Email;
            candidateInDb.BloodGroup = donationCandidate.BloodGroup;
            candidateInDb.Age        = donationCandidate.Age;
            candidateInDb.Address    = donationCandidate.Address;

            var candidateUpdated = await _donationCandidateRepository.Update(candidateInDb);

            return(_mapper.Map <DonationCandidateDTO>(candidateUpdated));
        }
        public async Task <ActionResult <DonationCandidateDTO> > Add(DonationCandidateDTO donationCandidate)
        {
            var candidateAdded = await _donationCandidateService.Save(donationCandidate);

            return(Ok(candidateAdded));
        }