public async Task <IActionResult> GetUserThread(int UserId, int recipientId) { if (UserId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var MessagesFromRepo = await _repo.GetMessageThread(UserId, recipientId); var messages = _mapper.Map <IEnumerable <MessageToReturnDto> >(MessagesFromRepo); return(Ok(messages)); }