Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Brigades brigades = db.Brigades.Find(id);

            db.Brigades.Remove(brigades);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "BrigadeId,DepartmentId,BrigadeName")] Brigades brigades)
 {
     if (ModelState.IsValid)
     {
         db.Entry(brigades).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", brigades.DepartmentId);
     return(View(brigades));
 }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "BrigadeId,DepartmentId,BrigadeName")] Brigades brigades)
        {
            if (ModelState.IsValid)
            {
                db.Brigades.Add(brigades);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", brigades.DepartmentId);
            return(View(brigades));
        }
Beispiel #4
0
        // GET: Brigades/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Brigades brigades = db.Brigades.Find(id);

            if (brigades == null)
            {
                return(HttpNotFound());
            }
            return(View(brigades));
        }
Beispiel #5
0
        // GET: Brigades/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Brigades brigades = db.Brigades.Find(id);

            if (brigades == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", brigades.DepartmentId);
            return(View(brigades));
        }