public async Task DeleteDonorPJ(DonorPJResponseDto donorPJDto)
        {
            var donorPJ = this.mapper.Map <DonorPJ>(donorPJDto);

            this.repository.Delete(donorPJ);
            await this.repository.SaveAsync();
        }
        public async Task UpdateDonorPJ(DonorPJResponseDto donorPJResponseDto, DonorPJUpdateDto donorPJDto)
        {
            var donorPJ = this.mapper.Map <DonorPJ>(donorPJDto);

            donorPJ.Id     = donorPJResponseDto.Id;
            donorPJ.UserId = donorPJResponseDto.UserId;

            this.repository.Udate(donorPJ);
            await this.repository.SaveAsync();
        }
        public async Task <ActionResult <DonorPJResponseDto> > GetDonorPJById(Guid id)
        {
            DonorPJResponseDto donorDto = await DonorPJApplication.GetDonorPJ(i => i.Id.Equals(id));

            if (donorDto == null)
            {
                ErrorMessage error = new ErrorMessage((int)HttpStatusCode.NotFound, $"O doador PJ, {id}, não foi encontrado.");
                return(NotFound(error));
            }

            return(Ok(donorDto));
        }
        public async Task <ActionResult> DeleteDonorPJ(Guid id)
        {
            // Check if the donor exists
            DonorPJResponseDto donorDto = await DonorPJApplication.GetDonorPJ(i => i.Id.Equals(id));

            if (donorDto == null)
            {
                ErrorMessage error = new ErrorMessage((int)HttpStatusCode.NotFound, $"O doador PJ, {id}, não foi encontrado.");
                return(NotFound(error));
            }

            await DonorPJApplication.DeleteDonorPJ(donorDto);

            return(NoContent());
        }