//public async Task CreateTaskAsync(Graph.GraphService graphService, CreateTaskViewModel model) //{ // var inspection = await GetInspectionById(model.InspectionId); // var property = inspection.sl_propertyID; // var unifiedGroupFetcher = graphService.groups.GetById(property.sl_group); // var unifiedGroup = await unifiedGroupFetcher.ExecuteAsync(); // var task = new Graph.Task // { // title = model.Title, // percentComplete = 0, // startDate = inspection.sl_datetime, // dueDate = inspection.sl_datetime, // // TODO: description = model.Description, // }; // await unifiedGroupFetcher.tasks.AddTaskAsync(task); //} public async Task <string> AnnotateImagesAsync(Graph.GraphService graphService, OneNoteService oneNoteService, string siteRootDirectory, int incidentId) { var getIncident = GetIncidentByIdAsync(incidentId); var incidentVideos = GetVideosAsync(AppSettings.VideoPortalIncidentsChannelName, incidentId); var incident = await getIncident; var property = incident.sl_propertyID; var sectionId = await GetOrCreateNoteBook(oneNoteService, notebookName) .ContinueWith(async task => { var _notebookId = task.Result.Id; var _sectionId = await oneNoteService.GetSectionIdAsync(_notebookId, property.Title); if (_sectionId == null) { _sectionId = await oneNoteService.CreateSectionAsync(_notebookId, property.Title); } return(_sectionId); }); var inspectionPhotos = GetInspectionOrRepairPhotosAsync("Room Inspection Photos", incident.sl_inspectionIDId.Value, incident.sl_roomID.Id); var pageUrl = await oneNoteService.CreatePageForIncidentAsync(siteRootDirectory, await sectionId, incident, await inspectionPhotos, await incidentVideos); return(pageUrl); }
public async Task <string> AnnotateImagesAsync(GraphServiceClient graphService, string siteRootDirectory, int incidentId) { var getIncident = GetIncidentByIdAsync(incidentId); var incidentVideos = GetVideosAsync(AppSettings.VideoPortalIncidentsChannelName, incidentId); var incident = await getIncident; var property = incident.sl_propertyID; var unifiedGroupFetcher = graphService.Groups[property.sl_group]; var unifiedGroup = await unifiedGroupFetcher.Request().GetAsync(); var notebookName = unifiedGroup.DisplayName + " Notebook"; var notebook = await OneNoteService.GetNoteBookByNameAsync(unifiedGroup, notebookName); var section = await OneNoteService.GetOrCreateSectionIdAsync(notebook.sectionsUrl, property.Title); var inspectionPhotos = GetInspectionOrRepairPhotosAsync("Room Inspection Photos", incident.sl_inspectionIDId.Value, incident.sl_roomID.Id); var pageUrl = await OneNoteService.CreatePageForIncidentAsync(graphService, siteRootDirectory, unifiedGroup, section, incident, await inspectionPhotos, await incidentVideos); return(pageUrl); }