Exemplo n.º 1
0
        private NetworkView GetNetworkView(string id)
        {
            GetRequest request = new GetRequest();

            request.ID = Guid.Parse(id);

            GetNetworkResponse response = this._networkService.GetNetwork(request);

            return(response.NetworkView);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetNetworkResponse response = new GetNetworkResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Network", targetDepth))
                {
                    var unmarshaller = NetworkUnmarshaller.Instance;
                    response.Network = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 3
0
        public GetNetworkResponse GetNetwork(GetRequest request)
        {
            GetNetworkResponse response = new GetNetworkResponse();

            try
            {
                Network     network     = new Network();
                NetworkView networkView = network.ConvertToNetworkView();

                network = _networkRepository.FindBy(request.ID);
                if (network != null)
                {
                    networkView = network.ConvertToNetworkView();
                }

                response.NetworkView = networkView;
            }
            catch (Exception ex)
            {
            }

            return(response);
        }