public ActionResult DeleteConfirmed(int id) { Ads.Models.Attribute attribute = db.Attributes.Find(id); db.Attributes.Remove(attribute); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AttributeID,Type,Name,Value,CategoryID")] Ads.Models.Attribute attribute) { if (ModelState.IsValid) { db.Entry(attribute).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", attribute.CategoryID); return(View(attribute)); }
// GET: Attributes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ads.Models.Attribute attribute = db.Attributes.Find(id); if (attribute == null) { return(HttpNotFound()); } return(View(attribute)); }
// GET: Attributes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ads.Models.Attribute attribute = db.Attributes.Find(id); if (attribute == null) { return(HttpNotFound()); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", attribute.CategoryID); return(View(attribute)); }