public ActionResult View(int id)
        {
            motherboard motherboardimage = new motherboard();

            using (new_testEntities db = new new_testEntities())
            {
                //db.ram.Add(new ram
                //{
                //    Brand = "testbrand",
                //    CompositionOfMemory = "wut",
                //    MemoryType = "testtype",
                //    Clockspeed = 1,
                //    CASlatency = 1,
                //    Voltage = 1,
                //    MemoryModuleConnection = 50,
                //    MemorySuitableFor = "datatest",
                //    ImagePath = "C:/Users/Erik/Desktop/Prj5-6/project-5-6 - Copy/webshop2/webshop2/Contentram1.jpg"
                //});

                //db.SaveChanges();

                motherboardimage = db.motherboard.Where(x => x.ID == id).FirstOrDefault();
            }
            return(View(motherboardimage));
        }
Example #2
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            motherboard motherboard = db.motherboards.Find(id);

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

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

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

            return(View(motherboard));
        }
Example #5
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));
            }
            motherboard motherboard = db.motherboards.Find(id);

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