public ActionResult DeleteConfirmed(int id) { EcoType_Ecolabel ecoType_Ecolabel = db.EcoType_Ecolabel.Find(id); db.EcoType_Ecolabel.Remove(ecoType_Ecolabel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,EcoTypeID,EcolabelID")] EcoType_Ecolabel ecoType_Ecolabel) { if (ModelState.IsValid) { db.Entry(ecoType_Ecolabel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EcolabelID = new SelectList(db.Ecolabels, "Id", "Name", ecoType_Ecolabel.EcolabelID); ViewBag.EcoTypeID = new SelectList(db.EcoTypes, "Id", "Name", ecoType_Ecolabel.EcoTypeID); return(View(ecoType_Ecolabel)); }
// GET: EcoType_Ecolabel/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EcoType_Ecolabel ecoType_Ecolabel = db.EcoType_Ecolabel.Find(id); if (ecoType_Ecolabel == null) { return(HttpNotFound()); } return(View(ecoType_Ecolabel)); }
public void AddType(List <int> TypesList, Ecolabel ecolabel) { if (TypesList != null) { int i = 0; foreach (int item in TypesList) { EcoType_Ecolabel ee = new EcoType_Ecolabel(); ee.EcolabelID = ecolabel.Id; ee.EcoTypeID = TypesList[i]; db.EcoType_Ecolabel.Add(ee); i++; } } }
// GET: EcoType_Ecolabel/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EcoType_Ecolabel ecoType_Ecolabel = db.EcoType_Ecolabel.Find(id); if (ecoType_Ecolabel == null) { return(HttpNotFound()); } ViewBag.EcolabelID = new SelectList(db.Ecolabels, "Id", "Name", ecoType_Ecolabel.EcolabelID); ViewBag.EcoTypeID = new SelectList(db.EcoTypes, "Id", "Name", ecoType_Ecolabel.EcoTypeID); return(View(ecoType_Ecolabel)); }