Beispiel #1
0
        //
        // GET: /Depots/Edit/5

        public ActionResult Edit(int id)
        {
            DEPOT depot = db.DEPOTS.Single(d => d.ID == id);

            ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID);
            return(View(depot));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            DEPOT depot = db.DEPOTS.Single(d => d.ID == id);

            db.DEPOTS.DeleteObject(depot);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        //
        // GET: /Depots/Details/5

        public ViewResult Details(int id)
        {
            DEPOT depot = db.DEPOTS.Single(d => d.ID == id);

            var boss = db.EMPLOYEES.Where(m => m.DEPOT_ID == depot.ID).FirstOrDefault();

            Session["depot_id"] = depot.ID;
            ViewBag.boss        = boss;

            return(View(depot));
        }
Beispiel #4
0
        public ActionResult Create(DEPOT depot)
        {
            if (ModelState.IsValid)
            {
                db.DEPOTS.AddObject(depot);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID);
            return View(depot);
        }
Beispiel #5
0
 public ActionResult Edit(DEPOT depot)
 {
     if (ModelState.IsValid)
     {
         db.DEPOTS.Attach(depot);
         db.ObjectStateManager.ChangeObjectState(depot, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID);
     return(View(depot));
 }
Beispiel #6
0
        public ActionResult Create(DEPOT depot)
        {
            if (ModelState.IsValid)
            {
                db.DEPOTS.AddObject(depot);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID);
            return(View(depot));
        }
Beispiel #7
0
 public ActionResult Edit(DEPOT depot)
 {
     if (ModelState.IsValid)
     {
         db.DEPOTS.Attach(depot);
         db.ObjectStateManager.ChangeObjectState(depot, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.REGION_ID = new SelectList(db.REGIONS, "ID", "NAME", depot.REGION_ID);
     return View(depot);
 }
Beispiel #8
0
        //
        // GET: /Depots/Delete/5

        public ActionResult Delete(int id)
        {
            DEPOT depot = db.DEPOTS.Single(d => d.ID == id);

            return(View(depot));
        }