private async Task LoadCarFeaturesAsync()
        {
            Collection <CarFeature> carFeatures = await _carRepository.GetAllCarFeatures();

            Collection <CarFeature> currentFeatures   = Car.CarFeatures;
            Collection <int>        currentFeaturesId = new Collection <int>();

            foreach (CarFeature carfeature in currentFeatures)
            {
                currentFeaturesId.Add(carfeature.Id);
            }


            foreach (CarFeature carFeature in carFeatures)
            {
                if (currentFeaturesId.Contains(carFeature.Id))
                {
                    CarFeatures.Add(new CarFeatureModelView(carFeature)
                    {
                        IsChecked = true
                    });
                }
                else
                {
                    CarFeatures.Add(new CarFeatureModelView(carFeature)
                    {
                        IsChecked = false
                    });
                }
            }
        }
Beispiel #2
0
        private void ShowCarFeatures()
        {
            List <CarFeature> carFeatures = Car.CarFeatures.ToList();

            foreach (CarFeature carFeature in carFeatures)
            {
                CarFeatures.Add(carFeature.Feature);
            }
        }