示例#1
0
        //[HttpGet("{id}", Name = "GetDonation")]
        //public async Task<IActionResult> GetDonation(int id)
        // [HttpGet("{id}", Name = "GetDonation")]


        // https://localhost:44366/api/donations
        public async Task <IActionResult> Get()
        {
            int id = 1;
            //if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            //    return Unauthorized();

            var donationFromRepo = await _repo.GetDonation(id);

            if (donationFromRepo == null)
            {
                return(NotFound());
            }

            return(Ok(donationFromRepo));
        }