public ActionResult DeleteConfirmed(int id) { BandComment bandComment = db.BandComments.Find(id); db.BandComments.Remove(bandComment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,BandID,UserId,Comment")] BandComment bandComment) { if (ModelState.IsValid) { db.Entry(bandComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", bandComment.UserId); ViewBag.BandID = new SelectList(db.Bands, "Id", "BandName", bandComment.BandID); return(View(bandComment)); }
// GET: BandComments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BandComment bandComment = db.BandComments.Find(id); if (bandComment == null) { return(HttpNotFound()); } return(View(bandComment)); }
public ActionResult Edit([Bind(Include = "Id,BandID,UserId,Comment")] BandComment bandComment) { if (ModelState.IsValid) { db.Entry(bandComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { id = bandComment.BandID })); } ViewBag.UserId = new SelectList(db.AspNetUsers.Where(u => u.Email == User.Identity.Name), "Id", "Email", bandComment.UserId); var favoriteBands = db.FavoriteBandLists.Where(fb => fb.AspNetUser.Email == User.Identity.Name); ViewBag.BandID = new SelectList(db.Bands.Join(favoriteBands, b => b.Id, fb => fb.BandId, (b, fb) => b), "Id", "BandName", bandComment.BandID); return(View(bandComment)); }
// GET: BandComments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BandComment bandComment = db.BandComments.Find(id); if (bandComment == null) { return(HttpNotFound()); } ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", bandComment.UserId); ViewBag.BandID = new SelectList(db.Bands, "Id", "BandName", bandComment.BandID); return(View(bandComment)); }
// GET: FavoriteBandComments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BandComment bandComment = db.BandComments.Find(id); if (bandComment == null) { return(HttpNotFound()); } ViewBag.UserId = new SelectList(db.AspNetUsers.Where(u => u.Email == User.Identity.Name), "Id", "Email", bandComment.UserId); var favoriteBands = db.FavoriteBandLists.Where(fb => fb.AspNetUser.Email == User.Identity.Name); ViewBag.BandID = new SelectList(db.Bands.Join(favoriteBands, b => b.Id, fb => fb.BandId, (b, fb) => b), "Id", "BandName", bandComment.BandID); return(View(bandComment)); }