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 <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Services.Course.CourseClient courseClient = new OpenHack.University.Services.Course.CourseClient();
            var courseContract = await courseClient.GetByIdAsync(id.Value);

            courseClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(webserviceUrl);

            Course = new Course()
            {
                CourseID = courseContract.CourseID, Credits = courseContract.Credits, Title = courseContract.Title
            };
            if (courseContract.Department != null)
            {
                Course.Department = new Department()
                {
                    Name = courseContract.Department.Name
                };
            }

            if (Course == null)
            {
                return(NotFound());
            }
            return(Page());
        }