public async Task <IActionResult> Create([FromBody] MessageItemRequest request) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userIdClaim = ((ClaimsIdentity)User.Identity).FindFirst(ClaimTypes.NameIdentifier); var userId = int.Parse(userIdClaim.Value); int id = await _requestRepository.AddMessage(request, userId); return(Ok(await _messageRepository.GetById(id))); }