コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BandComment bandComment = db.BandComments.Find(id);

            db.BandComments.Remove(bandComment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 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));
 }
コード例 #3
0
        // 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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        // 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));
        }
コード例 #6
0
        // 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));
        }