public ActionResult <IEnumerable <NodeDto> > GetMessagesForNode(int nodeId) { var currentUserId = int.Parse(User.Identity.Name); try { var node = _nodeService.ClaimCheck(nodeId); if (node.Gateway.UserId != currentUserId && !User.IsInRole(Role.Admin)) { return(Forbid()); } var messages = _nodeService.GetMessagesForNode(nodeId); var messagesDtoMap = _mapper.Map <IList <MessageDto> >(messages); return(Ok(messagesDtoMap)); } catch (AppException ex) { return(NotFound(ex.Message)); } }