public IActionResult GetDonorDonations(DonationStatus status) { var user = userRepository.GetUserFromPrincipal(HttpContext.User); if (!userRepository.IsActiveUser(user)) { return(new UnauthorizedResult()); } var donations = donationRepository.GetByDonorIdWithStatus(user.Id, (int)status); foreach (var donation in donations) { if (donation.RecipientId.HasValue) { donation.Recipient = userRepository.GetById(donation.RecipientId.Value); } } return(Ok(donations)); }