コード例 #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            hard_disk hard_disk = db.hard_disk.Find(id);

            db.hard_disk.Remove(hard_disk);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Edit([Bind(Include = "GID,Name,Specs,Image,Manufacture,cat_hard_disk_id")] hard_disk hard_disk)
        {
            var myrole = new Class1();
            var userID = User.Identity.GetUserId();

            ViewBag.currentrole = myrole.a(userID);
            if (ModelState.IsValid)
            {
                db.Entry(hard_disk).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.cat_hard_disk_id = new SelectList(db.CategoryHardDisks, "cat_hard_disk_id", "cat_hard_disk_name", hard_disk.cat_hard_disk_id);
            return(View(hard_disk));
        }
コード例 #3
0
        public ActionResult Details(Guid?id)
        {
            var myrole = new Class1();
            var userID = User.Identity.GetUserId();

            ViewBag.currentrole = myrole.a(userID);
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            hard_disk hard_disk = db.hard_disk.Find(id);

            if (hard_disk == null)
            {
                return(HttpNotFound());
            }
            return(View(hard_disk));
        }
コード例 #4
0
        public ActionResult Edit(Guid?id)
        {
            var myrole = new Class1();
            var userID = User.Identity.GetUserId();

            ViewBag.currentrole = myrole.a(userID);
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            hard_disk hard_disk = db.hard_disk.Find(id);

            if (hard_disk == null)
            {
                return(HttpNotFound());
            }
            ViewBag.cat_hard_disk_id = new SelectList(db.CategoryHardDisks, "cat_hard_disk_id", "cat_hard_disk_name", hard_disk.cat_hard_disk_id);
            return(View(hard_disk));
        }