Пример #1
0
        public JsonResult GetJsonOutputFromWebService()
        {
            localhost.ProductWebService webService = new localhost.ProductWebService();

            DemoVS4.WebReference.localhost.DridDataObj[] WebServiceItems = webService.ReadProduct("aaa");

            //Saop header value set
            localhost.AuthHeader authentication = new  localhost.AuthHeader();
            authentication.Password = "******";
            webService.AuthHeaderValue = authentication;
            //


            var ListWitoutFK = WebServiceItems.Select(x => new
            {
                ProductID = x.ProductID,
                ProductName = x.ProductName,
                UnitPrice = x.UnitPrice,
                UnitsInStock = x.UnitsInStock,
                Discontinued = x.Discontinued,
                Category = x.Category,
                CreatedDate = x.CreatedDate,
                Duration = 2
            });

            return Json(ListWitoutFK, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public JsonResult GetJsonOutputFromWebService()
        {
            localhost.ProductWebService webService = new localhost.ProductWebService();

            DemoVS4.WebReference.localhost.DridDataObj[] WebServiceItems = webService.ReadProduct("aaa");

            //Saop header value set
            localhost.AuthHeader authentication = new  localhost.AuthHeader();
            authentication.Password    = "******";
            webService.AuthHeaderValue = authentication;
            //


            var ListWitoutFK = WebServiceItems.Select(x => new
            {
                ProductID    = x.ProductID,
                ProductName  = x.ProductName,
                UnitPrice    = x.UnitPrice,
                UnitsInStock = x.UnitsInStock,
                Discontinued = x.Discontinued,
                Category     = x.Category,
                CreatedDate  = x.CreatedDate,
                Duration     = 2
            });

            return(Json(ListWitoutFK, JsonRequestBehavior.AllowGet));
        }