Ejemplo n.º 1
0
        public IActionResult GetRecipientDonations()
        {
            var user = userRepository.GetUserFromPrincipal(HttpContext.User);

            if (!userRepository.IsActiveUser(user))
            {
                return(new UnauthorizedResult());
            }

            var donations = donationRepository.GetByRecipientId(user.Id);

            foreach (var donation in donations)
            {
                donation.Donor = userRepository.GetById(donation.DonorId);
            }
            return(Ok(donations));
        }