예제 #1
0
        private TcpMessage HandleUniqueRelationQuery(TcpConnectedHost host, TcpMessage message)
        {
            if (!message.HasType(TcpRequestType.UniqueRelationQuery))
            {
                return(null);
            }

            if (!IsAuthenticated(host))
            {
                throw AuthException.NotLoggedIn();
            }

            var request = new ParamTcpMessage(message);

            var response = new ObjectTcpMessage <DbRelation>(TcpRequestType.List);

            if (request.HasParam("from_id") && request.HasParam("identifier"))
            {
                var fromId     = request.GetParamAsNullableInt("from_id");
                var identifier = request.GetParam("identifier");
                var relation   = _dataService.GetRelation(fromId, identifier);
                response.Add(relation);
                return(response);
            }

            return(TcpMessage.Error("Missing or badly formatted query parameters"));
        }
예제 #2
0
 public override DbRelation GetRelation(int?fromId, string identifier)
 {
     return(_dataService.GetRelation(fromId, identifier));
 }