public ActionResult Add(int id)
        {
            SalonManufacturersAuto SMA = new SalonManufacturersAuto();
            //List<Connection> listKonekcija = new List<Connection>();
            List <Manufacturer> listaProizvodjaca = new List <Manufacturer>();

            foreach (Connection connection in db.Connections.ToList())
            {
                if (connection.SalonId == id)
                {
                    //listKonekcija.Add(connection);
                    listaProizvodjaca.Add(db.Manufacturers.Find(connection.ManufacturerId));
                }
            }
            ViewBag.ManufacturerId = new SelectList(listaProizvodjaca, "Id", "Name");
            ViewBag.SalonId        = new SelectList(db.Salons, "Id", "Name");
            SMA.Manufacturers      = listaProizvodjaca;
            SMA.Automobile         = new Automobile();
            SMA.Salon = db.Salons.Find(id);
            return(View(SMA));
        }
        public ActionResult Add([Bind(Include = "Id,Model,Year,Power,Color,ManufacturerId,SalonId")] Automobile automobile)
        {
            List <Automobile> listAutomobiles = new List <Automobile>();

            foreach (Automobile a in db.Automobiles.ToList())
            {
                if (a.SalonId == automobile.SalonId)
                {
                    listAutomobiles.Add(a);
                }
            }
            if (ModelState.IsValid)
            {
                db.Automobiles.Add(automobile);
                db.SaveChanges();
                return(RedirectToAction("Index"));
                //return View("List", listAutomobiles);
            }

            ViewBag.ManufacturerId = new SelectList(db.Manufacturers, "Id", "Name", automobile.ManufacturerId);
            ViewBag.SalonId        = new SelectList(db.Salons, "Id", "Name", automobile.SalonId);

            SalonManufacturersAuto SMA = new SalonManufacturersAuto();
            List <Manufacturer>    listaProizvodjaca = new List <Manufacturer>();

            foreach (Connection connection in db.Connections.ToList())
            {
                if (connection.SalonId == automobile.SalonId)
                {
                    listaProizvodjaca.Add(db.Manufacturers.Find(connection.ManufacturerId));
                }
            }
            SMA.Manufacturers = listaProizvodjaca;
            SMA.Automobile    = automobile;
            SMA.Salon         = db.Salons.Find(automobile.SalonId);

            return(View(SMA));
        }