/// <summary> /// /// </summary> /// <param name="dc"></param> public static void AddDashboardPermissions(this DataContext dc) { var repo = new DashboardRepository(dc); var dashboards = dc.Dashboards; var users = dc.Users.ToList(); var teams = dc.Teams.ToList(); foreach (var d in dashboards) { var perms = new List <ED.Dashboards.DashboardPermission>(); TestFactory .SelectRandomObjects <User>(users) .ForEach(c => perms.Add(TestFactory.CreateDashboardPermission(d.Uid, c.ToModel()))); TestFactory .SelectRandomObjects <Team>(teams) .ForEach(c => perms.Add(TestFactory.CreateDashboardPermission(d.Uid, c.ToModel()))); Enumerable .Range(0, 1) .ToList() .ForEach(c => perms.Add(TestFactory.CreateDashboardPermission(d.Uid))); repo.UpdatePermissions(d.Id, perms); } }