コード例 #1
0
        // PUT api/values/5
        public int Put([FromBody] GravilotaScore newScore)
        {
            GravilotaScore gScore = new GravilotaScore();

            gScore.Id         = 6;
            gScore.PlayerName = newScore.PlayerName;
            gScore.Score      = newScore.Score;

            dbContext.GravilotaScore.Add(gScore);
            return(dbContext.SaveChanges());
        }
コード例 #2
0
    public IEnumerator SendWebRequest(double score)
    {
        GravilotaScore newScore = new GravilotaScore();

        newScore.Id         = 5;
        newScore.PlayerName = "Unity Player";
        newScore.Score      = score;

        www = UnityWebRequest.Put(webServiceURL, JsonUtility.ToJson(newScore));
        www.SetRequestHeader("Content-Type", "application/json");
        yield return(www.SendWebRequest());

        Debug.Log(www.downloadHandler.text);
    }
コード例 #3
0
    IEnumerator SendWebRequest(string Nombre, int Puntaje)
    {
        GravilotaScore newScore = new GravilotaScore();

        newScore.Id      = 0;
        newScore.Nombre  = Nombre;
        newScore.Puntaje = Puntaje;
        www = UnityWebRequest.Put(webserviceURL, JsonUtility.ToJson(Mi_Objeto)); // Mi objeto esta en el servicio web
        www.downloadHandler = new DownloadHandlerBuffer();
        www.SetRequestHeader("Content-Type", "application/json");

        // JsonUtility.ToJson(); // Con esta función le mandas un objeto, y lo conbierte a una string formato json
        yield return(www.SendWebRequest());

        Debug.Log(www.downloadHandler.text);
    }
コード例 #4
0
 // PUT api/values/5
 public int Put(int id, [FromBody] GravilotaScore newScore)
 {
     dbContext.GravilotaScore.Add(newScore);
     return(dbContext.SaveChanges());
 }