public IActionResult Get(int Id) { var user = userRepository.GetUserFromPrincipal(HttpContext.User); if (!userRepository.IsActiveUser(user)) { return(new UnauthorizedResult()); } var donation = donationRepository.GetById(Id); if (donation != null) { donation.Donor = userRepository.GetById(donation.DonorId); if (donation.RecipientId.HasValue) { donation.Recipient = userRepository.GetById(donation.RecipientId.Value); } return(Ok(donation)); } else { return(new NotFoundResult()); } }
public IActionResult Details(int id) { var model = DonationModel.FromEntity(donations.GetById(id)); return(View(model)); }