예제 #1
0
        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)));
        }