public ActionResult DeleteConfirmed(int id) { Attribute attribute = db.Attributes.Find(id); db.Attributes.Remove(attribute); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Attribute attribute) { if (ModelState.IsValid) { db.Entry(attribute).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", attribute.CategoryId); return(View(attribute)); }
public ActionResult Create(Attribute attribute) { if (ModelState.IsValid) { db.Attributes.Add(attribute); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", attribute.CategoryId); return(View(attribute)); }
// GET: Attributes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 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)); } Attribute attribute = db.Attributes.Find(id); if (attribute == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", attribute.CategoryId); return(View(attribute)); }