Ejemplo n.º 1
0
    public void Save()
    {
        RoutinePatientBody body = new RoutinePatientBody();

        body.active  = true;
        body.routine = this.routine;
        body.patient = this.InputField.GetComponent <TextMesh>().text;

        StartCoroutine(SendCreateRoutinePatient(body));
        this.SetPatient.SetActive(false);
        this.RoutinesList.GetComponent <ViewRoutinesAndSelect>().Clean();
        this.ManagementMenu.GetComponent <ManagementMenu>().GoToMainMenu();
    }
Ejemplo n.º 2
0
    IEnumerator SendCreateRoutinePatient(RoutinePatientBody body)
    {
        UnityWebRequest webRequest = new UnityWebRequest("http://phyreup.francecentral.cloudapp.azure.com:3000/routine-patient", "POST");
        string          jsonString = JsonUtility.ToJson(body);

        byte[] encodedPayload = new System.Text.UTF8Encoding().GetBytes(jsonString);
        webRequest.uploadHandler   = (UploadHandler) new UploadHandlerRaw(encodedPayload);
        webRequest.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        webRequest.SetRequestHeader("Content-Type", "application/json");
        webRequest.SetRequestHeader("cache-control", "no-cache");

        UnityWebRequestAsyncOperation requestHandel = webRequest.SendWebRequest();

        requestHandel.completed += delegate(AsyncOperation pOperation) {
        };


        yield return(null);
    }