Пример #1
0
        public async Task OnSaveClick()
        {
            Instructor.HireDate = DateTime.Parse($"{HireYear}/{HireMonth}/{HireDay}");
            Instructor.Courses  = new List <CourseAssignmentDto>();
            foreach (var item in AssignedCourses.Where(c => c.Assigned))
            {
                Instructor.Courses.Add(new CourseAssignmentDto
                {
                    CourseID    = item.CourseID,
                    CourseTitle = item.Title
                });
            }
            var created = await InstructorClient.Create(Instructor);

            UriHelper.NavigateTo("/instructors");
        }
Пример #2
0
        async Task LoadInstructor(string instructorId)
        {
            Instructor = await InstructorClient.GetDetails(instructorId);

            HireDay        = Instructor.HireDate.Day;
            HireMonth      = Instructor.HireDate.Month;
            HireYear       = Instructor.HireDate.Year;
            LastDayInMonth = DateTime.DaysInMonth(HireYear, HireMonth);

            var instructorCourses = new HashSet <int>(Instructor.Courses.Select(c => c.CourseID));

            AssignedCourses = new List <AssignedCourseData>();
            foreach (var course in Courses)
            {
                AssignedCourses.Add(new AssignedCourseData
                {
                    CourseID = course.Id,
                    Title    = course.Title,
                    Assigned = instructorCourses.Contains(course.Id)
                });
            }
        }
Пример #3
0
 public InstructorClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(InstructorClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Пример #4
0
 public InstructorClient(EndpointConfiguration endpointConfiguration) :
     base(InstructorClient.GetBindingForEndpoint(endpointConfiguration), InstructorClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Пример #5
0
 public InstructorClient() :
     base(InstructorClient.GetDefaultBinding(), InstructorClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IInstructor.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Пример #6
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(InstructorClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IInstructor));
 }
Пример #7
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(InstructorClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IInstructor));
 }