public ActionResult Edit([Bind(Include = "Song_ID,Category_ID,Detail")] Song_Category song_Category) { if (ModelState.IsValid) { db.Entry(song_Category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Category_ID = new SelectList(db.Categories, "ID", "Name", song_Category.Category_ID); ViewBag.Song_ID = new SelectList(db.Songs, "ID", "Name", song_Category.Song_ID); return(View(song_Category)); }
public ActionResult DeleteConfirmed(long?song_id, long?cat_id) { if (song_id == null || cat_id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Song_Category song_Category = db.Song_Category.Find(song_id, cat_id); db.Song_Category.Remove(song_Category); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Song_Category/Details/5 public ActionResult Details(long?song_id, long?cat_id) { if (song_id == null || cat_id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Song_Category song_Category = db.Song_Category.Find(song_id, cat_id); if (song_Category == null) { return(HttpNotFound()); } return(View(song_Category)); }
// GET: Song_Category/Edit/5 public ActionResult Edit(long?song_id, long?cat_id) { if (song_id == null || cat_id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Song_Category song_Category = db.Song_Category.Find(song_id, cat_id); if (song_Category == null) { return(HttpNotFound()); } ViewBag.Category_ID = new SelectList(db.Categories, "ID", "Name", song_Category.Category_ID); ViewBag.Song_ID = new SelectList(db.Songs, "ID", "Name", song_Category.Song_ID); return(View(song_Category)); }