示例#1
0
        public void UpdateUser(User user)
        {
            var client = new HttpClient();

            client.BaseAddress = new Uri(_baseAddress);

            string format = "users/{0}.json";

            string uri = String.Format(format, user.userId);

            var json = JsonConvert.SerializeObject(user);
            var result = client.PutAsJsonAsync(uri, user).Result;

            result.EnsureSuccessStatusCode();
        }
示例#2
0
        public void User_Is_Updated()
        {
            var qbase = new QBase("https://qcue-live.firebaseio.com");

            var user = new User
            {
                userId = "0e5d2d51-2bf7-4c1e-9d1a-952710f70725",
                fullName = "Alice Whyte",
                mobile = "4455523456789"
            };

            qbase.UpdateUser(user);
        }
示例#3
0
        public User AddAnonymousUser(string mobile)
        {
            var client = new HttpClient();

            var user = new User
            {
                userId = Convert.ToString(Guid.NewGuid()),
                fullName = "Anonymous",
                mobile = mobile
            };

            client.BaseAddress = new Uri(_baseAddress);

            string format = "users/{0}.json";

            string uri = String.Format(format, user.userId);

            var json = JsonConvert.SerializeObject(user);
            var result = client.PutAsJsonAsync(uri, user).Result;

            result.EnsureSuccessStatusCode();

            return user;
        }