public JsonResult LoadTaskList2() { var client = new HttpClient { BaseAddress = new Uri("https://localhost:44320/api/") }; client.DefaultRequestHeaders.Add("Authorization", HttpContext.Session.GetString(("JWToken"))); TaskListJson tasklist = null; var responseTask = client.GetAsync("TaskList/"); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var json = JsonConvert.DeserializeObject(result.Content.ReadAsStringAsync().Result).ToString(); tasklist = JsonConvert.DeserializeObject <TaskListJson>(json); } else { ModelState.AddModelError(string.Empty, "Server Error"); } return(Json(tasklist)); }
public TaskList(TaskListJson _taskListJson) { List = new SimplePriorityQueue <RemindedTask>(); _isLocked = _taskListJson._isLocked; foreach (var task in _taskListJson.List) { List.Enqueue(task, task.unixTime); } }