예제 #1
0
        public async Task <IHttpActionResult> AddGroupMessage([FromBody] MessageDto message)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var currentUserId = GetCurrentUserId();

            if (currentUserId == message.SenderId && message.IsGroup)
            {
                int id = await _messageService.AddGroupMessage(message);

                return(Ok(id));
            }
            else
            {
                return(StatusCode(HttpStatusCode.MethodNotAllowed));
            }
        }