public async void UpdateUnits() { foreach (int delete in UnitsToDelete) { SupplierDeliveryUnitService.DeleteSupplierDeliveryUnit(delete); } foreach (SupplierDeliveryUnit unit in Units) { if (unit.Id == 0) { await SupplierDeliveryUnitService.CreateSupplierDeliveryUnit(unit); } else { SupplierDeliveryUnitService.UpdateSupplierDeliveryUnit(unit.Id, unit); } } }
protected async override Task OnInitializedAsync() { profile = $"/profile_admin/{Id}"; country = $"/country_view/{Id}"; user = $"/user_view/{Id}"; article = $"/article_view/{Id}"; overview = $"/overview_admin/{Id}"; CurrentCountry = new Country(); CurrentCountry = await CountryService.GetCountry(Id); Customers = await VailedForCustomerService.GetVailedCustomers(CurrentCountry.Id); if (Customers == null) { Customers = new List <VailedForCustomer> { new VailedForCustomer() { Id = 0 } }; } else { NumberOfCustomers = Customers.Count - 1; } CompanyCodes = new List <CompanyCode>(); CompanyCodes = await CompanyCodeService.GetCompanyCodes(CurrentCountry.Id); if (CompanyCodes.Count == 0) { CompanyCodes.Add(new CompanyCode()); } else { NumberOfCodes = CompanyCodes.Count - 1; } Units = new List <SupplierDeliveryUnit>(); Units = await SupplierDeliveryUnitService.GetSupplierDeliveryUnits(CurrentCountry.Id); if (Units.Count == 0) { Units.Add(new SupplierDeliveryUnit()); } else { NumberOfUnits = Units.Count - 1; } OrderPickGroups = new List <Ilosorderpickgroup>(); OrderPickGroups = await ILOSOrderpickgroupService.GetILOSOrderpickgroup(CurrentCountry.Id); if (OrderPickGroups.Count == 0) { OrderPickGroups.Add(new Ilosorderpickgroup()); } else { NumberOfOrders = OrderPickGroups.Count - 1; } ILOSCodes = new List <PrimaryDciloscode>(); ILOSCodes = await PrimaryDCILOSCodeService.GetPrimaryDCILOSCodes(CurrentCountry.Id); if (ILOSCodes.Count == 0) { ILOSCodes.Add(new PrimaryDciloscode()); } else { NumberOfPrim = ILOSCodes.Count - 1; } TaxCodes = new List <VatTaxCode>(); TaxCodes = await VatTaxCodeService.GetVatTaxCodes(CurrentCountry.Id); if (TaxCodes.Count == 0) { TaxCodes.Add(new VatTaxCode()); } else { NumberOfTAX = TaxCodes.Count - 1; } ILOSCategories = new List <Iloscategory>(); ILOSCategories = await ILOSCategoriesService.GetILOSCategories(CurrentCountry.Id); if (ILOSCategories.Count == 0) { ILOSCategories.Add(new Iloscategory()); } else { NumberOfCat = ILOSCategories.Count - 1; } }