Пример #1
0
        public void AddProject(Project sc, string id)
        {
            StreamDataForProject sm = new StreamDataForProject {
                userName = id, name = sc.getName(), DeadLine = sc.getDeadline(), isTeam = sc.getIsTeam()
            };

            using (client = new HttpClient())
            {
                string json    = JsonConvert.SerializeObject(sm);
                var    content = new StringContent(json, Encoding.UTF8, "application/json");

                client.BaseAddress = new Uri(baseUrl);
                var r = client.PostAsync("Project/", content).Result;
            }
        }
Пример #2
0
        public void Update(Assignment sc)
        {
            StreamDataForProject sm = new StreamDataForProject {
                name = sc.getName(), DeadLine = sc.getDeadline()
            };

            using (client = new HttpClient())
            {
                string json    = JsonConvert.SerializeObject(sm);
                var    content = new StringContent(json, Encoding.UTF8, "application/json");

                client.BaseAddress = new Uri(baseUrl);
                var r = client.PutAsync(thisUrl + "/" + sc.getIdx(), content).Result;
            }
        }