示例#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);
 }
 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);
 }
 public void DeleteUserRole(UserRole userRole)
 {
     context.UserRole.Remove(userRole);
     context.SaveChanges();
 }
 public UserRole CreateUserRole(UserRole userRole)
 {
     userRole = context.UserRole.Add(userRole);
     context.SaveChanges();
     return userRole;
 }