public static async void AddLessonHistory(LessonHistory history) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(BASE_ADDRESS); using (var req = new HttpRequestMessage(HttpMethod.Post, "api/LessonHistoryApi/AddLessonHistory")) { req.Content = new StringContent(JsonConvert.SerializeObject(history), Encoding.UTF8, "application/json"); await client.SendAsync(req); } } }
public static void SaveLessonHistory(string lessonName, string teacherId, string className) { var lessonHistory = new LessonHistory { Lesson_name = lessonName, DateTime = DateTime.Now, Teacher_id = teacherId, Class_name = className }; WebHelper.AddLessonHistory(lessonHistory); }