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()); })); }
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())); }