public MembershipUser CreateUser(UserEntity userEntity) { MembershipUser membershipUser = GetUser(userEntity.Login, false); if (membershipUser != null) { return null; } userEntity.Password = Crypto.HashPassword(userEntity.Password); UserService.CreateUser(userEntity); var user = UserService.GetUserByLogin(userEntity.Login); var userRole = new RoleUserEntity { UserId = user.Id }; RoleEntity role = RoleService.GetAllRoleEntities().FirstOrDefault(r => r.RoleOfUser == "simple user"); if (role != null ) { userRole.RoleId = role.Id; } RoleUserService.CreateRoleUser(userRole); membershipUser = GetUser(userEntity.Login, false); return membershipUser; }
public void UpdateRoleUser(RoleUserEntity roleUser) { roleRepository.Update(roleUser.ToDalRoleUser()); uow.Commit(); }