예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Demand_Ecolabel demand_Ecolabel = db.Demand_Ecolabel.Find(id);

            db.Demand_Ecolabel.Remove(demand_Ecolabel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,EcolabelID,DemandID")] Demand_Ecolabel demand_Ecolabel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(demand_Ecolabel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DemandID   = new SelectList(db.Demands, "Id", "Rule", demand_Ecolabel.DemandID);
     ViewBag.EcolabelID = new SelectList(db.Ecolabels, "Id", "Name", demand_Ecolabel.EcolabelID);
     return(View(demand_Ecolabel));
 }
예제 #3
0
        // GET: Demand_Ecolabel/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Demand_Ecolabel demand_Ecolabel = db.Demand_Ecolabel.Find(id);

            if (demand_Ecolabel == null)
            {
                return(HttpNotFound());
            }
            return(View(demand_Ecolabel));
        }
 public void AddDemand(List <int> DemandsList, Ecolabel ecolabel)
 {
     if (DemandsList != null)
     {
         int i = 0;
         foreach (int elem in DemandsList)
         {
             Demand_Ecolabel de = new Demand_Ecolabel();
             de.EcolabelID = ecolabel.Id;
             de.DemandID   = DemandsList[i];
             db.Demand_Ecolabel.Add(de);
             i++;
         }
     }
 }
예제 #5
0
        // GET: Demand_Ecolabel/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Demand_Ecolabel demand_Ecolabel = db.Demand_Ecolabel.Find(id);

            if (demand_Ecolabel == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DemandID   = new SelectList(db.Demands, "Id", "Rule", demand_Ecolabel.DemandID);
            ViewBag.EcolabelID = new SelectList(db.Ecolabels, "Id", "Name", demand_Ecolabel.EcolabelID);
            return(View(demand_Ecolabel));
        }