public ActionResult DeleteConfirmed(int id)
        {
            Country_Ecolabel country_Ecolabel = db.Country_Ecolabel.Find(id);

            db.Country_Ecolabel.Remove(country_Ecolabel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,CountryID,EcolabelID")] Country_Ecolabel country_Ecolabel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(country_Ecolabel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryID  = new SelectList(db.Countries, "Id", "Name", country_Ecolabel.CountryID);
     ViewBag.EcolabelID = new SelectList(db.Ecolabels, "Id", "Name", country_Ecolabel.EcolabelID);
     return(View(country_Ecolabel));
 }
        // GET: Country_Ecolabel/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Country_Ecolabel country_Ecolabel = db.Country_Ecolabel.Find(id);

            if (country_Ecolabel == null)
            {
                return(HttpNotFound());
            }
            return(View(country_Ecolabel));
        }
 public void AddCountry(List <int> CountriesList, Ecolabel ecolabel)
 {
     if (CountriesList != null)
     {
         int i = 0;
         foreach (int elem in CountriesList)
         {
             Country_Ecolabel ce = new Country_Ecolabel();
             ce.EcolabelID = ecolabel.Id;
             ce.CountryID  = CountriesList[i];
             db.Country_Ecolabel.Add(ce);
             i++;
         }
     }
 }
        // GET: Country_Ecolabel/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Country_Ecolabel country_Ecolabel = db.Country_Ecolabel.Find(id);

            if (country_Ecolabel == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CountryID  = new SelectList(db.Countries, "Id", "Name", country_Ecolabel.CountryID);
            ViewBag.EcolabelID = new SelectList(db.Ecolabels, "Id", "Name", country_Ecolabel.EcolabelID);
            return(View(country_Ecolabel));
        }