示例#1
0
        public static async Task <List <PortLocation> > getLocations()
        {
            PrepareRestCall.getJson();
            List <PortLocation> locations = new List <PortLocation>();

            var response = await PrepareRestCall.HttpClientInstance.GetAsync("/location-registry/locations/?requestType=ALL");

            if (response.IsSuccessStatusCode)
            {
                var responseData = await response.Content.ReadAsAsync <IEnumerable <PortLocation> >();

                locations = responseData.ToList();
            }
            return(locations);
        }
示例#2
0
        public static async Task <PortCall> getPortCallById(string id)
        {
            PrepareRestCall.getJson();

            PortCall pc = new PortCall();

            var response = await PrepareRestCall.HttpClientInstance.GetAsync(String.Format("dmp/port_calls/{0}", id));

            if (response.IsSuccessStatusCode)
            {
                pc = await response.Content.ReadAsAsync <PortCall>();
            }

            return(pc);
        }
示例#3
0
        public static async Task <List <PortCall> > getPortCalls()
        {
            PrepareRestCall.getJson();

            List <PortCall> pc = null;

            var response = await PrepareRestCall.HttpClientInstance.GetAsync("dmp/port_calls");

            if (response.IsSuccessStatusCode)
            {
                var responseData = await response.Content.ReadAsAsync <IEnumerable <PortCall> >();

                pc = responseData.ToList();
            }
            return(pc);
        }
示例#4
0
        public static async Task <Vessel> getVesselByImo(string imo)
        {
            PrepareRestCall.getJson();
            string vesselId = "urn:mrn:stm:vessel:IMO:" + imo;

            Vessel v = new Vessel();

            var response = await PrepareRestCall.HttpClientInstance.GetAsync(String.Format("vr/vessel/{0}", vesselId));

            if (response.IsSuccessStatusCode)
            {
                v = await response.Content.ReadAsAsync <Vessel>();
            }

            return(v);
        }