Пример #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            optical optical = db.opticals.Find(id);

            db.opticals.Remove(optical);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult Edit([Bind(Include = "GID,Name,Specs,Image,Manufacture")] optical optical)
        {
            var myrole = new Class1();
            var userID = User.Identity.GetUserId();

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

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

            return(View(optical));
        }
Пример #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));
            }
            optical optical = db.opticals.Find(id);

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