public ActionResult UploadOneAbc(Abc abc, Cba cba)
 {
     this.uploadedObject = new List <object> {
         abc, cba
     };
     this.nullsInInputs = abc.a == null || abc.b == null || abc.c == null || cba.a == null || cba.b == null || cba.c == null;
     return(new EmptyResult());
 }
Beispiel #2
0
 public JsonResult UpDownloadOneCbaFromAbc(Abc abc, Cba cba)
 {
     this.uploadedObject = new List <object> {
         abc, cba
     };
     this.nullsInInputs = abc.a == null || abc.b == null || abc.c == null || cba.a == null || cba.b == null || cba.c == null;
     return(Json(new Cba()
     {
         a = abc.a, b = abc.b, c = abc.c
     }));
 }
Beispiel #3
0
        public JsonResult EchoAbcAsCba(Abc abc)
        {
            if (abc == null)
            {
                return(Json(null));
            }
            var cba = new Cba()
            {
                a = abc.a, b = abc.b, c = abc.c
            };

            return(Json(cba, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public ActionResult Index()
        {
            if (Request.Url.AbsoluteUri.Contains(@"Home/Index"))
            {
                return(Redirect("/"));
            }
            ViewBag.Title = "Home Page";
            var model = new IndexViewModel();
            var abc   = new Abc {
                a = 1, b = new Bclass(2.2), c = "Drei"
            };

            using (JsonWebClient client = new JsonWebClient())
                model.results.Add("Result1",
                                  client.UploadObject(url(@"Home/EchoAOfABC"), abc));

            using (JsonWebClient client = new JsonWebClient())
            {
                Cba r = client.UpDownloadObject <Cba>(url(@"Home/EchoAbcAsCba"), abc);
                model.results.Add("Result2",
                                  $"Result has type {r.GetType()} and values {r}");
            }

            // Download
            model.results.Add("Download one Abc:",
                              JsonWebClient.DownloadObject <Abc>(url(@"DownloadCheck/DownloadOneAbc")).ToString());
            model.results.Add("Download a DateTime:",
                              JsonWebClient.DownloadObject <DateTime>(url(@"DownloadCheck/DownloadServerDateTime"), "PATCH").ToString("u"));


            //UpDownload
            var abc3 = new Abc()
            {
                a = 11, b = new Bclass(2.2), c = "Drei und Dreißig"
            };
            var cba3 = new Cba()
            {
                a = 333, b = new Bclass(2.22), c = "Hundertelf"
            };
            var transportList = new List <object>();

            transportList.Add(abc3);
            transportList.Add(cba3);

            model.results.Add("UpDownload two objects, the secound is:",
                              JsonWebClient.UpDownloadObject <Cba>(transportList, url(@"UpDownloadCheck/UpDownloadOneCbaFromAbc")).ToString());


            return(View(model));
        }