public async Task<ActionResult> ScheduleRepair(ScheduleRepairModel model) { model.TimeSlotsSelectedValue = DateTime.ParseExact(string.Format("{0} {1}:00", model.TimeSlotsSelectedDateValue, model.TimeSlotsSelectedHoursValue), "yyyy-MM-dd HH:mm", null); var sharePointToken = AuthenticationHelper.GetAccessTokenAsync(AppSettings.DemoSiteServiceResourceId); var graphService = AuthenticationHelper.GetGraphServiceAsync(AADAppSettings.GraphResourceUrl); var tasksService = new TasksService(await sharePointToken); var dashboardModel = new Dashboard(await sharePointToken); await dashboardModel.UpdateRepairScheduleInfoToIncidentAsync(model) .ContinueWith(async task => await tasksService.CompleteRepairAssignmentTaskAsync(model.IncidentId)); await dashboardModel.ScheduleRepairAsync(await graphService, model); await dashboardModel.CreateGroupRepairEventAsync(await graphService, model); await dashboardModel.CreateO365TaskAsync(await graphService, model); return RedirectToAction("Index"); }
public async Task<ActionResult> AuditRepair(AuditRepairModel model) { var sharePointToken = await AuthenticationHelper.GetAccessTokenAsync(AppSettings.DemoSiteServiceResourceId); Dashboard dashboardModel = new Dashboard(sharePointToken); var tasksService = new TasksService(sharePointToken); await tasksService.CompleteRepairApprovalTaskAsync(model); if (model.Result == ApprovalResult.Approved) await dashboardModel.ApproveRepairAsync(model.IncidentId); return RedirectToAction("Index"); }