Ejemplo n.º 1
0
        // GET api/chat/5
        public IHttpActionResult GetChat(int id)
        {
            string userId = User.Identity.GetUserId();
            List <MessageViewModel> messages;

            try
            {
                messages = ChatsService.GetUserChatMessages(userId, id);
            }
            catch (NullReferenceException ex)
            {
                return(BadRequest());
            }
            catch (UnauthorizedAccessException ex)
            {
                return(Unauthorized());
            }

            return(Ok(messages));
        }