public ActionResult DeleteConfirmed(int id) { Embellishment embellishment = db.Embellishments.Find(id); db.Embellishments.Remove(embellishment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "EmbellishmentsID,DescriptionID,ColorID,SeasonID,OccasionID,Photo")] Embellishment embellishment) { if (ModelState.IsValid) { db.Entry(embellishment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ColorID = new SelectList(db.Colors, "ColorID", "Name", embellishment.ColorID); ViewBag.DescriptionID = new SelectList(db.Descriptions, "DescriptionID", "Name", embellishment.DescriptionID); ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "Name", embellishment.OccasionID); ViewBag.SeasonID = new SelectList(db.Seasons, "SeasonID", "Name", embellishment.SeasonID); return(View(embellishment)); }
// GET: Embellishments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Embellishment embellishment = db.Embellishments.Find(id); if (embellishment == null) { return(HttpNotFound()); } return(View(embellishment)); }
// GET: Embellishments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Embellishment embellishment = db.Embellishments.Find(id); if (embellishment == null) { return(HttpNotFound()); } ViewBag.ColorID = new SelectList(db.Colors, "ColorID", "Name", embellishment.ColorID); ViewBag.DescriptionID = new SelectList(db.Descriptions, "DescriptionID", "Name", embellishment.DescriptionID); ViewBag.OccasionID = new SelectList(db.Occasions, "OccasionID", "Name", embellishment.OccasionID); ViewBag.SeasonID = new SelectList(db.Seasons, "SeasonID", "Name", embellishment.SeasonID); return(View(embellishment)); }