Exemple #1
0
    private void makeVote(ParseObject obj, string col, string lk, ParseUser user)
    {
        int v = 0;
        try {
            v = obj.Get<int>(col) + 1;
        } catch (Exception e) {
            v++;
        }

        int all = 0;
        try {
            v = obj.Get<int>("numberOfVotes") + 1;
        } catch (Exception e) {
            all++;
        }

        obj.Increment(col);
        obj.Increment("numberOfVotes");
        obj.SaveAsync().ContinueWith(t => {
            ParseObject Like = new ParseObject("Participant");
            Like.SaveAsync().ContinueWith(tt => {
                Like["choozy"] = obj;
                Like["user"] = user;
                Like["choice"] = lk;
                Like["status"] = "Voted";
                Like.ACL = new ParseACL(user)
                {
                    PublicReadAccess = true,
                    PublicWriteAccess = false
                };

                Like.SaveAsync().ContinueWith(ttt => {
                    g.decrementVote(obj);
                });
            });
        });
    }