Ejemplo n.º 1
0
        public object Execute(XElement operationElement)
        {
            XNamespace ns = Constants.DefaultLegacyNamespace;

            var id = PrimitiveTypeParser.Parse <long>(operationElement.Descendants(ns + "taskId").First().Value);

            Task task = null;

            try
            {
                task = _inquiryProcessor.GetTask(id);
            }
            catch (RootObjectNotFoundException)
            {
                // Eat it. Just return an empty response.
            }

            using (var stream = new MemoryStream())
            {
                var serializer = new XmlSerializer(typeof(Task), Constants.DefaultLegacyNamespace);
                serializer.Serialize(stream, task);

                stream.Seek(0, 0);

                var xDocument      = XDocument.Load(stream, LoadOptions.None);
                var taskAsXElement = xDocument.Descendants(ns + "Task");
                return(taskAsXElement.Elements());
            }
        }
Ejemplo n.º 2
0
        public Task GetTask(long id)
        {
            var task = _taskByIdInquiryProcessor.GetTask(id);

            return(task);
        }