public ActionResult CreateBike()
        {
            Console.WriteLine("hej fra dropdown fyld");
//            CreateBike cs = new CreateBike();


            List <Brand>       b = client.GetBrands();
            List <BicycleType> t = client.GetTypes();
            List <Wheel>       w = client.GetWheelSizes();
            List <Frame>       f = client.GetFrameSizes();

            List <SelectListItem> Brands    = new List <SelectListItem>();
            List <SelectListItem> Types     = new List <SelectListItem>();
            List <SelectListItem> WheelSize = new List <SelectListItem>();
            List <SelectListItem> FrameSize = new List <SelectListItem>();


            foreach (var VARIABLE in b)
            {
                Brands.Add(new SelectListItem {
                    Text = VARIABLE.Name, Value = VARIABLE.Id.ToString()
                });
            }

            foreach (var VARIABLE in t)
            {
                Types.Add(new SelectListItem {
                    Text = VARIABLE.TypeName, Value = VARIABLE.Id.ToString()
                });
            }

            foreach (var VARIABLE in w)
            {
                WheelSize.Add(new SelectListItem {
                    Text = VARIABLE.Size.ToString(), Value = VARIABLE.Id.ToString()
                });
            }

            foreach (var VARIABLE in f)
            {
                FrameSize.Add(new SelectListItem {
                    Text = VARIABLE.Size.ToString(), Value = VARIABLE.Id.ToString()
                });
            }

            DropdownDetails details = new DropdownDetails {
                Brands = Brands, Types = Types, Frames = FrameSize, Wheels = WheelSize
            };

            return(View(details));
        }
Exemple #2
0
        // Udfylder standard dropdowns fra service
        private void PopulateComboBoxes()
        {
            Brands = BikeService.GetBrands();
            BrandComboBox.ItemsSource = Brands;

            List <Frame> Frames = BikeService.GetFrameSizes();

            FrameComboBox.ItemsSource = Frames;

            List <Wheel> Wheels = BikeService.GetWheelSizes();

            WheelComboBox.ItemsSource = Wheels;

            List <BicycleType> Types = BikeService.GetTypes();

            TypeComboBox.ItemsSource = Types;
        }