public void AddtoDatabase(TeacherCodeModel tc) { var client = new HttpClient(); var c = new ChallengetoTeacherStudentCode(); c.FromTeacherModel(tc); var r = JsonConvert.SerializeObject(c); var stringstuff = new StringContent(r, Encoding.UTF8, "application/json"); //var res = client.PostAsync("http://localhost:63040/api/Challenges", stringstuff).GetAwaiter().GetResult(); var res = client.PostAsync(serverhttp + "/api/Challenges", stringstuff).GetAwaiter().GetResult(); }
public TeacherCodeModel UpdatetoDatabase(TeacherCodeModel tc) { var client = new HttpClient(); var convert = new ChallengetoTeacherStudentCode(); convert.FromTeacherModel(tc); var r = JsonConvert.SerializeObject(tc); var stringstuff = new StringContent(r, Encoding.UTF8, "application/json"); //var res = client.PutAsync("http://*****:*****@"C:\inetpub\")); // TODO: make variable exe names }
public TeacherCodeModel GetFromDatabase(int id) { var teachcode = new TeacherCodeModel(); var client = new HttpClient(); //var res = client.GetAsync("http://*****:*****@"C:\inetpub\"); } else { return(null); } return(teachcode); }