示例#1
0
        /// <summary>
        /// To determine Orion value
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>orion status</returns>
        public IActionResult CheckOrion(string id)
        {
            var client  = new InventoryClient();
            var request = new BasicVersionByCID
            {
                ContentID = new string[] { id }
            };

            GetBasicVersionInformationByCIDResponseMessage response = null;

            Task.Run(async() =>
            {
                response = await client.GetBasicVersionInformationByCIDAsync(request);
            }).Wait();

            return(Json(response));
        }
示例#2
0
        public Content Get(string contentId)
        {
            var client  = new InventoryClient();
            var request = new BasicVersionByCID
            {
                ContentID = new string[] { contentId }
            };

            GetBasicVersionInformationByCIDResponseMessage result = null;

            Task.Run(async() =>
            {
                result = await client.GetBasicVersionInformationByCIDAsync(request);
            }).Wait();

            if (result == null)
            {
                return(new Content());
            }

            var response = result.ResultByCID;

            if (response == null || response.Length < 1)
            {
                return(new Content());
            }

            if (response.Length > 1)
            {
                throw new Exception(string.Format("To many versions were returned from Orion. ContentId: {0}", contentId));
            }

            return(new Content
            {
                ContentId = contentId,
                MaterialIds = response[0].Segments.Select(s => s.MaterialID).ToList()
            });
        }