public async Task<ActionResult> CreateDemoData(SuiteLevelWebApp.Models.ProvisionDemoData model)
        {
            string token = await O365Util.GetAccessToken(ServiceResources.Dashboard);            
            using (var clientContext = TokenHelper.GetClientContextWithAccessToken(DemoSiteCollectionUrl, token))
            {
                AuthenticationHelper adHelp =new AuthenticationHelper();
                await adHelp.CreateADUsersAndGroups();
                SiteProvisioning siteProvisioning = new SiteProvisioning(clientContext);
                siteProvisioning.AddSiteContents();
                siteProvisioning.UpdateInspectionListItem(model.dateDemo);

                model.Message = "The AAD Groups, AAD Users, and demo data have been created successfully.  The initial password for all the users is: TempP@ssw0rd!";
                TempData["datetime"] = model;
                return RedirectToAction("ProvisionDemoData");
            }
        }
        private async Task<RepairPeople> GetRepairPeopleByEmailAddress(string userPrincipalName)
        {
            AuthenticationHelper adHelp = new AuthenticationHelper();
            Microsoft.Azure.ActiveDirectory.GraphClient.User repairPeople = await adHelp.GetADUserByPrincipalName(userPrincipalName);

            RepairPeople retRepairPeople = null;
            if(repairPeople!=null)
            {
                retRepairPeople= new RepairPeople()
                {
                    Title = repairPeople.DisplayName,
                    sl_emailaddress = repairPeople.UserPrincipalName
                };
            }
            return retRepairPeople;

            /*string resturl = "/_api/lists/GetByTitle('Repair People')/Items?"
                + "$select=Id,Title,sl_accountname,sl_emailaddress"
                + string.Format("&$Filter=(Id eq {0})", id);

            string responseString = await RestHelper.GetRestData(resturl, _token);

            return JObject.Parse(responseString)["d"]["results"].ToObject<RepairPeople[]>().FirstOrDefault();*/


        }
 public static Task <ClientContext> GetAdminSiteClientContextAsync()
 {
     return(AuthenticationHelper.GetSharePointClientContextAsync(
                AppSettings.AdminSiteServiceResourceId,
                AppSettings.AdminSiteServiceResourceId));
 }
        private async Task<List<RepairPeople>> GetRepairPeople()
        {
           /* string resturl = "/_api/lists/GetByTitle('Repair People')/Items?"
                + "$select=Id,Title,sl_accountname,sl_emailaddress";

            string responseString = await RestHelper.GetRestData(resturl, _token);

            return JObject.Parse(responseString)["d"]["results"].ToObject<RepairPeople[]>();*/
            List<RepairPeople> repairlist = new List<RepairPeople>();
            AuthenticationHelper adHelp = new AuthenticationHelper();
            List<Microsoft.Azure.ActiveDirectory.GraphClient.User> allUsers = await adHelp.GetADUsersByGroupName("Repair People");
            foreach(Microsoft.Azure.ActiveDirectory.GraphClient.User user in allUsers)
            {
                RepairPeople repairPeople = new RepairPeople()
                {
                    Title = user.DisplayName,
                    sl_emailaddress = user.UserPrincipalName
                };
                repairlist.Add(repairPeople);
            }
            return repairlist;
        }
 public static Task <ClientContext> GetDemoSiteClientContextAsync()
 {
     return(AuthenticationHelper.GetSharePointClientContextAsync(
                AppSettings.DemoSiteServiceResourceId,
                AppSettings.DemoSiteCollectionUrl));
 }