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)); }
public ActionResult DeleteConfirmed(Guid id) { motherboard motherboard = db.motherboards.Find(id); db.motherboards.Remove(motherboard); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
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)); }