宝臣 王 преди 3 месеца
родител
ревизия
4276088efe
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

+ 3 - 3
UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

@@ -39,7 +39,7 @@ namespace UniformMaterialManagementSystem.ViewModels
         private ICollection<Company> _companyList = [];
 
         [ObservableProperty]
-        private Company _selectedCompany = null!;
+        private Company? _selectedCompany;
 
         [ObservableProperty]
         [Required(ErrorMessage = "用户名不能为空")]
@@ -87,9 +87,9 @@ namespace UniformMaterialManagementSystem.ViewModels
                 Password = PasswordHashing.GenerateSaltedHash(Password, salt),
                 UserName = UserName,
                 LoginName = UserName,
-                CompanyGuid = SelectedCompany.Guid,
+                CompanyGuid = SelectedCompany?.Guid,
                 Company = SelectedCompany,
-                CompanyName = SelectedCompany.Name,
+                CompanyName = SelectedCompany?.Name,
                 IsEnabled = true,
                 RegisterDate = DateTime.Now,
                 Roles = [_roles[SelectedUnitType]],