Ejemplo n.º 1
0
        public async Task <IActionResult> Get(Guid donationId)
        {
            var donationDto = await _donationService.GetDonation(donationId);

            var mapper        = new MapperConfiguration(cfg => cfg.CreateMap <DonationDto, DonationViewModel>()).CreateMapper();
            var donationModel = mapper.Map <DonationDto, DonationViewModel>(donationDto);

            return(Ok(donationModel));
        }
Ejemplo n.º 2
0
        public ActionResult <Donation> Get(string donationId)
        {
            if (String.IsNullOrEmpty(donationId))
            {
                throw new ArgumentException($"{nameof(donationId)} can not be null");
            }

            var donation = _donationService.GetDonation(donationId);

            return(Ok(donation));
        }