Add missing list initialization in admin pages.

This commit is contained in:
2020-08-09 19:15:00 +01:00
parent 8beec5b6c7
commit fb1b9dd275
6 changed files with 35 additions and 28 deletions

View File

@@ -81,12 +81,14 @@ namespace Marechai.Pages.Admin.Details
!_creating)
return;
_countries = await CountriesService.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new BookViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_countries = await CountriesService.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_machineFamilies = await MachineFamiliesService.GetAsync();
_model = _creating ? new BookViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_bookCompanies = await CompaniesByBookService.GetByBook(Id);
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
StartsWith("admin/books/edit/",

View File

@@ -84,6 +84,7 @@ namespace Marechai.Pages.Admin.Details
_model = _creating ? new DocumentViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_documentCompanies = await CompaniesByDocumentService.GetByDocument(Id);
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
StartsWith("admin/documents/edit/",

View File

@@ -85,6 +85,7 @@ namespace Marechai.Pages.Admin.Details
_model = _creating ? new MagazineViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_magazineCompanies = await CompaniesByMagazineService.GetByMagazine(Id);
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
StartsWith("admin/magazines/edit/",

View File

@@ -77,12 +77,13 @@ namespace Marechai.Pages.Admin.Details
!_creating)
return;
_softwareFamilies = await Service.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new SoftwareFamilyViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_softwareFamilies = await Service.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new SoftwareFamilyViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_softwareFamilyCompanies = await CompaniesBySoftwareFamilyService.GetBySoftwareFamily(Id);
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
StartsWith("admin/software_families/edit/",

View File

@@ -40,7 +40,7 @@ namespace Marechai.Pages.Admin.Details
{
bool _addingCompany;
int? _addingCompanyId;
string _addingCompanyRoleId;
string _addingCompanyRoleId;
AuthenticationState _authState;
List<CompanyViewModel> _companies;
bool _creating;
@@ -94,13 +94,14 @@ namespace Marechai.Pages.Admin.Details
!_creating)
return;
_softwareVariants = await Service.GetAsync();
_softwareVersions = await SoftwareVersionsService.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new SoftwareVariantViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_softwareVariants = await Service.GetAsync();
_softwareVersions = await SoftwareVersionsService.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new SoftwareVariantViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_softwareVariantCompanies = await CompaniesBySoftwareVariantService.GetBySoftwareVariant(Id);
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
StartsWith("admin/software_variants/edit/",

View File

@@ -82,14 +82,15 @@ namespace Marechai.Pages.Admin.Details
!_creating)
return;
_softwareVersions = await Service.GetAsync();
_softwareFamilies = await SoftwareFamiliesService.GetAsync();
_licenses = await LicensesService.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new SoftwareVersionViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_softwareVersions = await Service.GetAsync();
_softwareFamilies = await SoftwareFamiliesService.GetAsync();
_licenses = await LicensesService.GetAsync();
_companies = await CompaniesService.GetAsync();
_roles = await DocumentRolesService.GetEnabledAsync();
_model = _creating ? new SoftwareVersionViewModel() : await Service.GetAsync(Id);
_authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
_addingCompanyRoleId = _roles.First().Id;
_softwareVersionCompanies = await CompaniesBySoftwareVersionService.GetBySoftwareVersion(Id);
_editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
StartsWith("admin/software_versions/edit/",