/// <summary> /// Associates a user with an organisation. The user is created if the specified username is not present. The status /// of the user is set to active by default. /// </summary> /// <param name="organisation"></param> /// <param name="username"></param> /// <param name="userStatus"></param> /// <returns></returns> public OrganisationUser CreateOrganisationUser(Organisation organisation, string username, int userStatus = 2) { var organisationUser = new OrganisationUser(); organisationUser.Id = Guid.NewGuid(); organisationUser.OrganisationId = organisation.Id; organisationUser.UserId = GetOrCreateUser(username).Id; organisationUser.UserStatus = userStatus; model.OrganisationUsers.Add(organisationUser); return(organisationUser); }
/// <summary> /// Associates a user with an organisation. The user is created if the specified username is not present. The status /// of the user is set to active by default. /// </summary> /// <param name="organisation"></param> /// <param name="username"></param> /// <param name="userStatus"></param> /// <returns></returns> public OrganisationUser CreateOrganisationUser(Organisation organisation, string username, int userStatus = 2) { var organisationUser = new OrganisationUser(); organisationUser.Id = Guid.NewGuid(); organisationUser.OrganisationId = organisation.Id; organisationUser.UserId = GetOrCreateUser(username).Id; organisationUser.UserStatus = userStatus; model.OrganisationUsers.Add(organisationUser); return organisationUser; }