public ActionResult DeleteConfirmed(int id) { CustomerSong customerSong = db.CustomerSongs.Find(id); db.CustomerSongs.Remove(customerSong); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,SongId,CustomerId")] CustomerSong customerSong) { if (ModelState.IsValid) { db.Entry(customerSong).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "UserName", customerSong.CustomerId); ViewBag.SongId = new SelectList(db.Songs, "Id", "Title", customerSong.SongId); return(View(customerSong)); }
// GET: CustomerSongs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerSong customerSong = db.CustomerSongs.Find(id); if (customerSong == null) { return(HttpNotFound()); } return(View(customerSong)); }
// GET: CustomerSongs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerSong customerSong = db.CustomerSongs.Find(id); if (customerSong == null) { return(HttpNotFound()); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "UserName", customerSong.CustomerId); ViewBag.SongId = new SelectList(db.Songs, "Id", "Title", customerSong.SongId); return(View(customerSong)); }