public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } var courseClient = new OpenHack.University.Services.Course.CourseClient(); courseClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(webserviceUrl); var courseContract = await courseClient.GetByIdAsync(id.Value); Course = new Course() { CourseID = courseContract.CourseID, Credits = courseContract.Credits, DepartmentID = courseContract.DepartmentID, Title = courseContract.Title }; if (Course == null) { return(NotFound()); } var departmentClient = new OpenHack.University.Services.Department.DepartmentClient(); // Select current DepartmentID. PopulateDepartmentsDropDownList(departmentClient, Course.DepartmentID); return(Page()); }
public async Task OnGetAsync() { var departmentClient = new OpenHack.University.Services.Department.DepartmentClient(); departmentClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(webserviceUrl); var departmentContractList = await departmentClient.SearchAsync(); Department = new List <Department>(); foreach (var departmentContract in departmentContractList) { var department = new Department() { Budget = departmentContract.Budget, DepartmentID = departmentContract.DepartmentID, InstructorID = departmentContract.InstructorID, Name = departmentContract.Name, StartDate = departmentContract.StartDate, }; if (departmentContract.Administrator != null) { department.Administrator = new Instructor() { FirstMidName = departmentContract.Administrator.FirstMidName, LastName = departmentContract.Administrator.LastName }; } Department.Add(department); } }
public async Task <IActionResult> OnGetAsync(int id, bool?concurrencyError) { var departmentClient = new OpenHack.University.Services.Department.DepartmentClient(); var departmentContract = await departmentClient.GetByIdAsync(id); Department = new Department() { Budget = departmentContract.Budget, DepartmentID = departmentContract.DepartmentID, InstructorID = departmentContract.InstructorID, Name = departmentContract.Name, StartDate = departmentContract.StartDate }; if (Department == null) { return(NotFound()); } if (concurrencyError.GetValueOrDefault()) { ConcurrencyErrorMessage = "The record you attempted to delete " + "was modified by another user after you selected delete. " + "The delete operation was canceled and the current values in the " + "database have been displayed. If you still want to delete this " + "record, click the Delete button again."; } return(Page()); }
public async Task <IActionResult> OnGetAsync(int id) { OpenHack.University.Services.Department.DepartmentClient departmentClient = new OpenHack.University.Services.Department.DepartmentClient(); var departmentContract = await departmentClient.GetByIdAsync(id); Department = new Department() { Budget = departmentContract.Budget, DepartmentID = departmentContract.DepartmentID, InstructorID = departmentContract.InstructorID, Name = departmentContract.Name, StartDate = departmentContract.StartDate }; if (Department == null) { return(NotFound()); } OpenHack.University.Services.Instructor.InstructorClient instructorClient = new OpenHack.University.Services.Instructor.InstructorClient(); var instructorListContract = await instructorClient.SearchAsync(); var instructors = new List <Instructor>(); foreach (var instructor in instructorListContract) { instructors.Add(new Instructor() { FirstMidName = instructor.FirstMidName, HireDate = instructor.HireDate, ID = instructor.ID, LastName = instructor.LastName }); } // Use strongly typed data rather than ViewData. InstructorNameSL = new SelectList(instructors, "ID", "FirstMidName"); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } var departmentClient = new OpenHack.University.Services.Department.DepartmentClient(); departmentClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(webserviceUrl); var departmentContract = await departmentClient.GetByIdAsync(id.Value); Department = new Department() { Budget = departmentContract.Budget, DepartmentID = departmentContract.DepartmentID, InstructorID = departmentContract.InstructorID, Name = departmentContract.Name, StartDate = departmentContract.StartDate }; return(Page()); }