Esempio n. 1
0
        public ActionResult Create([Bind(Include = "AlbumID,Title,ReviewID")] Album album)
        {
            if (ModelState.IsValid)
            {
                db.Albums.Add(album);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(album));
        }
        public ActionResult Create([Bind(Include = "ArtistID,Albums,Name")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                db.Artists.Add(artist);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(artist));
        }
        public ActionResult Create([Bind(Include = "ReviewId,Contents,ReviewerEmail")] Review review)
        {
            if (ModelState.IsValid)
            {
                db.Reviews.Add(review);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(review));
        }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "ReviewID,AlbumID,Contents,ReviwerEmail")] Review review)
        {
            if (ModelState.IsValid)
            {
                db.Reviews.Add(review);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AlbumID = new SelectList(db.Albums, "AlbumID", "Title", review.AlbumID);
            return(View(review));
        }
        public ActionResult Create([Bind(Include = "AlbumId,Title,ArtistId")] Album album)
        {
            if (ModelState.IsValid)
            {
                db.Albums.Add(album);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
            return(View(album));
        }
Esempio n. 6
0
        public ActionResult Create(Album album)
        {
            if (ModelState.IsValid)
            {
                db.Albums.Add(album);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ArtistId = new SelectList(db.Artists, "ArtistID", "Name", album.ArtistId);
            ViewBag.GenreId  = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
            return(View(album));
        }
Esempio n. 7
0
 public Artist AddArtist(Artist newArtist)
 {
     _mvcMusicStoreContext.Artist.Add(newArtist);
     _mvcMusicStoreContext.SaveChanges();
     return(newArtist);
 }