public IActionResult Update(int donationId, [FromBody] UpdateDonationDTO updateDonation) { try { _donationAppService.Update(donationId, updateDonation); return(Ok()); } catch (KeyNotFoundException) { return(NotFound()); } }
public void Update(int donationId, UpdateDonationDTO updateDonationDTO) { var parsedDonationId = int.Parse(updateDonationDTO.BloodCenterId); var donation = _donationRepository.GetById(donationId); var bloodcenter = _bloodcenterRepository.GetById(int.Parse(updateDonationDTO.BloodCenterId)); var parsedSchedule = DateTime.Parse(updateDonationDTO.Schedule); donation.Update(parsedDonationId, updateDonationDTO.Status, parsedSchedule, bloodcenter ); _donationRepository.Update(donation); }