public TOrganizationUser AcceptUserInvitation(Guid userInvitationId, TCreateUserForm form) { var userInvitation = GetUserInvitation(userInvitationId); form.Login = userInvitation.Email; var user = userManager.CreateActiveUser(form); var utcNow = DateTimeOffset.UtcNow; var organizationUserId = Guid.NewGuid(); var organizationUser = new TOrganizationUser { OrganizationUserId = organizationUserId, OrganizationId = userInvitation.OrganizationId, UserId = user.UserId, DateTimeCreated = utcNow }; userInvitation.Status = UserInvitationStatus.Accepted; userInvitation.DateTimeProcessed = utcNow; userInvitationStorage.UpdateUserInvitation(userInvitation); organizationUserStorage.CreateOrganizationUser(organizationUser); return(organizationUserStorage.FindOrganizationUser(organizationUserId)); }
public TOrganization CreateOrganization(TOrganizationCreateForm form, Guid userId) { var organizationId = Guid.NewGuid(); var organization = organizationProcessor.Create(form, organizationId); organizationStorage.CreateOrganization(organization); var organizationUser = new TOrganizationUser { OrganizationUserId = Guid.NewGuid(), OrganizationId = organizationId, UserId = userId, DateTimeCreated = DateTimeOffset.UtcNow, IsAdministrator = true }; organizationUserStorage.CreateOrganizationUser(organizationUser); return(organizationStorage.FindOrganization(organizationId)); }