public async Task <IActionResult> Get(int kullaniciNo, int id)
 {
     return(await KullaniciVarsaCalistir <IActionResult>(async() =>
     {
         if (kullaniciNo != aktifKullaniciNo)
         {
             return Unauthorized();
         }
         var mesajFromRepo = await mesajRepo.BulAsync(id);
         if (mesajRepo == null)
         {
             return NotFound("Mesaj bulunamadı");
         }
         return Ok(mesajFromRepo.ToListeDto());
     }));
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Get(int kullaniciNo, int id)
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            if (kullaniciNo != int.Parse(userId))
            {
                return(Unauthorized());
            }
            var mesajFromRepo = await mesajRepo.BulAsync(id);

            if (mesajRepo == null)
            {
                return(NotFound("Mesaj bulunamadı"));
            }
            return(Ok(mesajFromRepo.ToListeDto()));
        }