예제 #1
0
        public IActionResult RecipientRelist(int Id)
        {
            var user = userRepository.GetUserFromPrincipal(HttpContext.User);

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

            var donation = donationRepository.GetById(Id);

            if (donation == null)
            {
                return(new NotFoundResult());
            }

            if (user.Id != donation.RecipientId)
            {
                return(new UnauthorizedResult());
            }

            donationRepository.RelistDonation(Id);
            return(Ok());
        }