public static PersonNote Translate(PCONote inputNote) { var note = new PersonNote(); note.PersonId = inputNote.person_id.Value; note.DateTime = inputNote.created_at; note.Id = inputNote.id; note.NoteType = inputNote.note_category.name; note.CreatedByPersonId = inputNote.created_by_id; note.Text = inputNote.note; return(note); }
public static List <PCONote> GetNotes(bool importing, DateTime?updatedAfter, string apiEndPoint) { // Create variables to store the results var dataItems = new List <PCOData>(); var includedItems = new List <PCOData>(); // Set the endpoint if not passed from parameter apiEndPoint = apiEndPoint ?? "https://api.planningcenteronline.com/people/v2/notes?include=category"; // Query Planning Center for people if (PCOGetItems(apiEndPoint, dataItems, includedItems, updatedAfter, !importing, "", "")) { // Create variable to store the people var notes = new List <PCONote>(); // Loop through each item in the result of api call foreach (var item in dataItems) { // Create the person record var note = new PCONote(item); if (note != null) { // Update the contact information note.UpdateCategory(item, includedItems); // Add to list of results notes.Add(note); } } // return the list of people return(notes); } // An error occurred trying to query people so return null return(null); }