public async Task <IActionResult> ExistingStudents() { var(isSuccess, jediStudents) = await _jediEnrollmentService.GetExistingStudents(); var viewModel = new ExistingStudentsViewModel(); if (isSuccess) { viewModel.JediStudents = jediStudents; } return(View(viewModel)); }
public async Task <IActionResult> ExistingStudents() { // Edited by CPang 2020-07-15 Challenge 1 var(isSuccessGetStudents, jediStudents) = await _jediEnrollmentService.GetExistingStudents(); var(isSuccessGetSpecies, species) = await _jediEnrollmentService.GetAvailableSpecies(); // Edited by CPang 2020-07-17 Challenge 3 var(isSuccessGetPlanets, planets) = await _jediEnrollmentService.GetAvailablePlanets(); var viewModel = new ExistingStudentsViewModel(); if (isSuccessGetStudents && isSuccessGetSpecies && isSuccessGetPlanets) { viewModel.JediStudents = jediStudents; viewModel.Species = species; viewModel.Planets = planets; } return(View(viewModel)); }