public ActionResult Edit(int id) { EditEmployeeApplicant NewEmployeeApplicant = new EditEmployeeApplicant(); //Get the selected employee application from the database string url = "EmployeeApplicantsData/FindApplication/" + id; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { EmployeeApplicantDto SelectedApplication = response.Content.ReadAsAsync <EmployeeApplicantDto>().Result; NewEmployeeApplicant.EmployeeApplicant = SelectedApplication; } else { return(RedirectToAction("Error")); } //Get all users from the database for dropdown list url = "EmployeeApplicantsData/GetUsers"; response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { IEnumerable <ApplicationUserDto> SelectedUsers = response.Content.ReadAsAsync <IEnumerable <ApplicationUserDto> >().Result; NewEmployeeApplicant.AllUsers = SelectedUsers; } else { return(RedirectToAction("Error")); } //Get all courses from the database for dropdown list url = "EmployeeApplicantsData/GetCourses"; response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { IEnumerable <CoursesDto> SelectedJobs = response.Content.ReadAsAsync <IEnumerable <CoursesDto> >().Result; NewEmployeeApplicant.AllCourses = SelectedJobs; } else { return(RedirectToAction("Error")); } return(View(NewEmployeeApplicant)); }
public ActionResult Create() { GetApplicationCookie(); //Get all the users for dropdown list EditEmployeeApplicant EditEmployeeApplicant = new EditEmployeeApplicant(); string url = "EmployeeApplicantsData/GetUsers"; HttpResponseMessage response = client.GetAsync(url).Result; IEnumerable <ApplicationUserDto> SelectedUsers = response.Content.ReadAsAsync <IEnumerable <ApplicationUserDto> >().Result; EditEmployeeApplicant.AllUsers = SelectedUsers; User.Identity.GetUserId(); //Get all the Courses for dropdown list url = "EmployeeApplicantsData/GetCourses"; response = client.GetAsync(url).Result; IEnumerable <CoursesDto> SelectedCourses = response.Content.ReadAsAsync <IEnumerable <CoursesDto> >().Result; EditEmployeeApplicant.AllCourses = SelectedCourses; return(View(EditEmployeeApplicant)); }