示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CustomerSong customerSong = db.CustomerSongs.Find(id);

            db.CustomerSongs.Remove(customerSong);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 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));
 }
示例#3
0
        // 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));
        }
示例#4
0
        // 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));
        }