private static void UpdateDetails(Instructor instructor, _.CreateEdit.Command message) { instructor.FirstMidName = message.FirstMidName; instructor.LastName = message.LastName; instructor.HireDate = message.HireDate.GetValueOrDefault(); if (string.IsNullOrWhiteSpace(message.OfficeAssignmentLocation)) { instructor.OfficeAssignment = null; } else if (instructor.OfficeAssignment == null) { instructor.OfficeAssignment = new OfficeAssignment { Location = message.OfficeAssignmentLocation }; } else { instructor.OfficeAssignment.Location = message.OfficeAssignmentLocation; } }
public static void Handle(this Instructor instructor, _.CreateEdit.Command message) { UpdateDetails(instructor, message); UpdateInstructorCourses(instructor, message.Courses); }