コード例 #1
0
        public ActionResult Create(PathVM evm)
        {
            try
            {
                idp            = Convert.ToInt32(HttpContext.Request.Params.Get("idSelected"));
                evm.patient    = new PatientVM();
                evm.patient.id = getUserId(idp);
                if (Session["authtoken"] == null)
                {
                    return(RedirectToAction("Login", "Auth"));
                }

                HttpClient Client = new HttpClient();
                Client.DefaultRequestHeaders.Authorization =
                    new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Session["authtoken"] + "");
                Client.BaseAddress = new Uri("http://localhost:18080");
                evm.date_path      = evm.date_path.Replace("/", "-");

                Client.PostAsJsonAsync <PathVM>("epione-jee-web/api/paths", evm).ContinueWith((PostTask) => PostTask.Result.EnsureSuccessStatusCode());
                //return new JsonResult { Data = evm, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #2
0
        public ActionResult Edit(PathVM path)
        {
            try
            {
                if (Session["authtoken"] == null)
                {
                    return(RedirectToAction("Login", "Auth"));
                }

                HttpClient Client = new HttpClient();
                Client.DefaultRequestHeaders.Authorization =
                    new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Session["authtoken"] + "");
                Client.BaseAddress = new Uri("http://localhost:18080");


                Client.PostAsJsonAsync <PathVM>("epione-jee-web/api/paths", path).ContinueWith((PostTask) => PostTask.Result.EnsureSuccessStatusCode());

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }