public ActionResult Create(Genre genre) { if (ModelState.IsValid) { db.Genres.Add(genre); db.SaveChanges(); TempData["createdId"] = genre.Id; TempData["createdName"] = genre.Name; return RedirectToAction("Genre","Manage"); } return View(); }
private Album DomToAlbum(AlbumPage albumPage, Genre category) { return new Album { PublicDate = albumPage.ReleaseDate, Genre = category, Name = albumPage.Title, Songs=DomsToSongs(albumPage.SongRows) }; }
public ActionResult Edit(Genre newGenre) { Genre oldGenre = db.Genres.FirstOrDefault(g => g.Id == newGenre.Id); if (oldGenre == null) return HttpNotFound(); oldGenre.Name = newGenre.Name; db.SaveChanges(); TempData["success"] = true; return View(); }