Exemplo n.º 1
0
        public ActionResult PublishMessage()
        {
            TestObjectDto postMessage = new TestObjectDto
            {
                Message = "Message posted from WebHost!"
            };
            var response = RequestManager.Post<ResponseDto<TestObjectDto>>("api/TestApi/PostMessage",
                postMessage);
            if (response.IsSuccessful)
            {
                TestModel = new TestModel
                {
                    TestObject = response.Payload,
                };
            }
            else
            {
                TestModel = new TestModel
                {
                    TestObject = new TestObjectDto
                    {
                        Message = response.Messages.First().Message,
                    },
                };
            }

            return View(ViewNames.TestIndex, TestModel);
        }
Exemplo n.º 2
0
        public VoidResponseDto PublishMessage(TestObjectDto testObjectDto)
        {
            var queueMessage = new QueueMessage<OrderPrintingMessage>
            {
                MessageContent = new OrderPrintingMessage
                {
                    OrderDetail = testObjectDto.Message,
                }
            };

            var response = new VoidResponseDto();

            try
            {
                OrderPrintingMessageBusClient.Publish(queueMessage);
                response.IsSuccessful = true;
            }
            catch (Exception e)
            {
                response.IsSuccessful = false;
            }

            return response;
        }
Exemplo n.º 3
0
        public VoidResponseDto PostMessage(TestObjectDto postMessage)
        {
            var response = TestService.PublishMessage(postMessage);

            return response;
        }