Example #1
0
        public void Updade(int donorId, UpdateDonorDTO updateDonor)
        {
            DateTime parsedBirthDate = DateTime.Parse(updateDonor.BirthDate);
            var      donor           = _donorRepository.GetById(donorId);

            donor.Update(updateDonor.FirstName,
                         updateDonor.LastName,
                         parsedBirthDate,
                         updateDonor.RegistrationId,
                         updateDonor.Username,
                         updateDonor.Password,
                         updateDonor.Gender,
                         updateDonor.BloodType
                         );
            _donorRepository.Update(donor);
        }
Example #2
0
        public int Create(CreateDonationDTO createDonationDTO)
        {
            DateTime createdAt      = DateTime.UtcNow;
            var      donor          = _donorRepository.GetById(int.Parse(createDonationDTO.DonorId));
            var      bloodcenter    = _bloodcenterRepository.GetById(int.Parse(createDonationDTO.BloodCenterId));
            var      parsedSchedule = DateTime.Parse(createDonationDTO.Schedule);

            Donation donation = new Donation(int.Parse(createDonationDTO.DonorId),
                                             int.Parse(createDonationDTO.BloodCenterId),
                                             createDonationDTO.Status,
                                             parsedSchedule,
                                             createdAt
                                             );

            return(_donationRepository.Create(donation));
        }