예제 #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            psu psu = db.psus.Find(id);

            db.psus.Remove(psu);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Edit([Bind(Include = "GID,Name,Specs,Image,Manufacture")] psu psu)
        {
            var myrole = new Class1();
            var userID = User.Identity.GetUserId();

            ViewBag.currentrole = myrole.a(userID);
            if (ModelState.IsValid)
            {
                db.Entry(psu).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(psu));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "GID,Name,Specs,Image,Manufacture")] psu psu)
        {
            var myrole = new Class1();
            var userID = User.Identity.GetUserId();

            ViewBag.currentrole = myrole.a(userID);
            if (ModelState.IsValid)
            {
                psu.GID = Guid.NewGuid();
                db.psus.Add(psu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(psu));
        }
예제 #4
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));
            }
            psu psu = db.psus.Find(id);

            if (psu == null)
            {
                return(HttpNotFound());
            }
            return(View(psu));
        }