예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblSongs tblSongs = db.tblSongs.Find(id);

            db.tblSongs.Remove(tblSongs);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "SongID,ArtistID,SongName,SongYear")] tblSongs tblSongs)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblSongs).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ArtistID = new SelectList(db.tblArtist, "ArtistID", "ArtistName", tblSongs.ArtistID);
     return(View(tblSongs));
 }
예제 #3
0
        // GET: Songs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblSongs tblSongs = db.tblSongs.Find(id);

            if (tblSongs == null)
            {
                return(HttpNotFound());
            }
            return(View(tblSongs));
        }
예제 #4
0
        // GET: Songs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblSongs tblSongs = db.tblSongs.Find(id);

            if (tblSongs == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ArtistID = new SelectList(db.tblArtist, "ArtistID", "ArtistName", tblSongs.ArtistID);
            return(View(tblSongs));
        }