宝臣 王 пре 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]],