예제 #1
0
 public UserRole CreateUserRole(User user, Organisation organisation, Role role)
 {
     UserRole userRole = new UserRole()
     {
         User = user,
         Organisation = organisation,
         Role = role
     };
     return repo.CreateUserRole(userRole);
 }
예제 #2
0
 public UserRole CreateUserRole(long userId, long organisationId, Role role)
 {
     var org = context.Organisations.Find(organisationId);
     var user = context.User.Find(userId);
     UserRole userRole = new UserRole()
     {
         Organisation = org,
         User = user,
         Role = role
     };
     userRole = context.UserRole.Add(userRole);
     context.SaveChanges();
     return userRole;
 }
 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;
 }
예제 #4
0
 public void DeleteUserRole(UserRole userRole)
 {
     repo.DeleteUserRole(userRole);
 }
예제 #5
0
 public void DeleteUserRole(UserRole userRole)
 {
     context.UserRole.Remove(userRole);
     context.SaveChanges();
 }
예제 #6
0
 public UserRole CreateUserRole(UserRole userRole)
 {
     userRole = context.UserRole.Add(userRole);
     context.SaveChanges();
     return userRole;
 }