public IActionResult GetTestTimeEditTasks() { //Variable to store the data we are going to send to the front-end. CalendarModel tasks = new CalendarModel(); //Get course codes from the user List <string> courses = new List <string>(); List <Course> courseObjects = _db.Courses.Where(w => w.UserId == _userManager.GetUserAsync(User).Result.Id).ToList(); foreach (var obj in courseObjects) { courses.Add(obj.Code); } //Add TimeEdit reservation to tasks in the calendar //Get all reservation from the te controller foreach (var res in _te.GetAllTest(courses).Result) { //Take out every task out from the list foreach (var te in res.Reservations) { //Add the task to the te tasks.AddTask(te); } } //Return OK code with the task payload return(Ok(tasks.GetTask())); }