Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UnitsSet unitsSet = db.UnitsSet.Find(id);

            db.UnitsSet.Remove(unitsSet);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Description,StudentsId")] UnitsSet unitsSet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(unitsSet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentsId = new SelectList(db.StudentsSet, "Id", "FirstName", unitsSet.StudentsId);
     return(View(unitsSet));
 }
Exemple #3
0
        // GET: UnitsSets/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UnitsSet unitsSet = db.UnitsSet.Find(id);

            if (unitsSet == null)
            {
                return(HttpNotFound());
            }
            return(View(unitsSet));
        }
Exemple #4
0
        // GET: UnitsSets/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UnitsSet unitsSet = db.UnitsSet.Find(id);

            if (unitsSet == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StudentsId = new SelectList(db.StudentsSet, "Id", "FirstName", unitsSet.StudentsId);
            return(View(unitsSet));
        }