public IEnumerable<User> ReadCoOrganiserFromOrganisation(Organisation organisation)
        {
            IEnumerable<UserRole> userRoles = context.UserRole.Include("Organisation").Include("User").Where(o => o.Organisation.Id == organisation.Id).Where(a => a.Role == Role.Co_Organiser);

            List<User> users = userRoles.Select(userRole => userRole.User).ToList();
            return users.AsEnumerable();
        }
 public User ReadOrganiserFromOrganisation(Organisation organisation)
 {
     UserRole userRole = context.UserRole
         .Include("Organisation")
         .Include("User")
         .Where(o => o.Organisation.Id == organisation.Id).First();
     
     return context.User.SingleOrDefault(o => o.Id == userRole.User.Id);
 }
示例#3
0
 public UserRole CreateUserRole(User user, Organisation organisation, Role role)
 {
     UserRole userRole = new UserRole()
     {
         User = user,
         Organisation = organisation,
         Role = role
     };
     return repo.CreateUserRole(userRole);
 }
 public Organisation CreateOrganisation(string name, string bannerUrl, User organisator)
 {
     Organisation organisation = new Organisation
     {
         Name = name,
         BannerUrl = bannerUrl,
         DashboardBlocks = new List<DashboardBlock>(),
         Playlists = new List<Playlist>(),
     };
     return organisationsRepository.CreateOrganisation(organisation, organisator);
 }
        public void Initialize()
        {
           
            playlistManager = new PlaylistManager(new PlaylistRepository(new EFDbContext(ContextEnum.BeatBuddyTest)), new UserRepository(new EFDbContext(ContextEnum.BeatBuddyTest)));
            userManager = new UserManager(new UserRepository(new EFDbContext(ContextEnum.BeatBuddyTest)));
            organisationManager = new OrganisationManager(new OrganisationRepository(new EFDbContext(ContextEnum.BeatBuddyTest)));
            _userWithOrganisation = userManager.CreateUser("*****@*****.**", "matthias", "test", "acidshards", "");
            _userWithoutOrganisation = userManager.CreateUser("*****@*****.**", "heylen", "jos", "acidshards", "");

            playlist = playlistManager.CreatePlaylistForUser("testplaylist", "gekke playlist om te testen", "125", 5, true, "", _userWithOrganisation);
            _userControllerWithAuthenticatedUserWithOrganisation = MyWebApi.Controller<UserController>()
                .WithResolvedDependencyFor<PlaylistManager>(playlistManager)
                .WithResolvedDependencyFor<UserManager>(userManager)
                .WithResolvedDependencyFor<OrganisationManager>(organisationManager)
                .WithAuthenticatedUser(
                 u => u.WithIdentifier("NewId")
                       .WithUsername(_userWithOrganisation.Email)
                       .WithClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, _userWithOrganisation.Email))
                       .WithClaim(new System.Security.Claims.Claim("sub", _userWithOrganisation.Email))
                );

            _userControllerWithAuthenticatedUserWithoutOrganisation = MyWebApi.Controller<UserController>()
                .WithResolvedDependencyFor<PlaylistManager>(playlistManager)
                .WithResolvedDependencyFor<UserManager>(userManager)
                .WithResolvedDependencyFor<OrganisationManager>(organisationManager)
                .WithAuthenticatedUser(
                 u => u.WithIdentifier("NewId")
                       .WithUsername(_userWithOrganisation.Email)
                       .WithClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, _userWithoutOrganisation.Email))
                       .WithClaim(new System.Security.Claims.Claim("sub", _userWithoutOrganisation.Email))
                );

            Track track = new Track()
            {
                Artist = "Metallica",
                Title = "Master of Puppets (live)",
                CoverArtUrl = "",
                Duration = 800,
                TrackSource = new TrackSource
                {
                    SourceType = SourceType.YouTube,
                    Url = "https://www.youtube.com/watch?v=kV-2Q8QtCY4"
                }
            };
            Track addedtrack = playlistManager.AddTrackToPlaylist(playlist.Id, track);


            organisation = organisationManager.CreateOrganisation("gek organisatie test","",_userWithOrganisation);
        }
 public Organisation CreateOrganisation(Organisation organisation, User user)
 {
     organisation = context.Organisations.Add(organisation);
     context.SaveChanges();
     var user1 = context.User.Find(user.Id);
     var organisation1 = context.Organisations.Find(organisation.Id);
     UserRole userRole = new UserRole
     {
         Organisation = organisation1,
         User = user1,
         Role = Role.Organiser
     };
     context.UserRole.Add(userRole);
     context.SaveChanges();
     return organisation;
 }
        public void Initialize()
        {
            userManager = new UserManager(new UserRepository(new EFDbContext(ContextEnum.BeatBuddyTest)));
            organisationManager = new OrganisationManager(new OrganisationRepository(new EFDbContext(ContextEnum.BeatBuddyTest)));
            user = userManager.CreateUser("*****@*****.**", "matthias", "test", "acidshards", "");

            _organisationControllerWithAuthenticatedUser = MyWebApi.Controller<OrganisationsController>()
               .WithResolvedDependencyFor<IUserManager>(userManager)
               .WithResolvedDependencyFor<IOrganisationManager>(organisationManager)
               .WithAuthenticatedUser(
                u => u.WithIdentifier("NewId")
                      .WithUsername(user.Email)
                      .WithClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Email, user.Email))
                      .WithClaim(new System.Security.Claims.Claim("sub", user.Email))
               );

           organisation =  organisationManager.CreateOrganisation("testorganisatie", "", user);

        }
示例#8
0
 public IEnumerable<User> ReadCoOrganiserFromOrganisation(Organisation organisation)
 {
     return repo.ReadCoOrganiserFromOrganisation(organisation);
 }
示例#9
0
 public IEnumerable<UserRole> ReadUserRolesForOrganisation(Organisation organisation)
 {
     return repo.ReadUserRolesForOrganisation(organisation);
 }
示例#10
0
 public User ReadOrganiserFromOrganisation(Organisation organisation)
 {
     return repo.ReadOrganiserFromOrganisation(organisation);
 }
 public Organisation UpdateOrganisation(Organisation organisation)
 {
     return organisationsRepository.UpdateOrganisation(organisation);
 }
 public Organisation UpdateOrganisation(Organisation organisation)
 {
     context.Entry(organisation).State = EntityState.Modified;
     context.SaveChanges();
     return organisation;
 }
 public IEnumerable<UserRole> ReadUserRolesForOrganisation(Organisation organisation)
 {
     return context.UserRole.Where(o => o.Organisation == organisation);
 }