示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Hard_disks hard_disks = db.Hard_disks.Find(id);

            db.Hard_disks.Remove(hard_disks);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Price,Delivery,Order,Maker")] Hard_disks hard_disks)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hard_disks).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Delivery = new SelectList(db.Deliveries, "Id", "date", hard_disks.Delivery);
     ViewBag.Maker    = new SelectList(db.Makers, "Id", "Name", hard_disks.Maker);
     ViewBag.Order    = new SelectList(db.Orders, "Id", "date", hard_disks.Order);
     return(View(hard_disks));
 }
示例#3
0
        // GET: Hard_disks/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hard_disks hard_disks = db.Hard_disks.Find(id);

            if (hard_disks == null)
            {
                return(HttpNotFound());
            }
            return(View(hard_disks));
        }
示例#4
0
        // GET: Hard_disks/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hard_disks hard_disks = db.Hard_disks.Find(id);

            if (hard_disks == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Delivery = new SelectList(db.Deliveries, "Id", "date", hard_disks.Delivery);
            ViewBag.Maker    = new SelectList(db.Makers, "Id", "Name", hard_disks.Maker);
            ViewBag.Order    = new SelectList(db.Orders, "Id", "date", hard_disks.Order);
            return(View(hard_disks));
        }