public ActionResult Create() { SongViewModel songViewModel = new SongViewModel() { Artists = _artistService.GetAllArtistEntities().ToMvcArtist(), Genres = _genreService.GetAllGenreEntities().ToMvcGenre() }; return View(songViewModel); }
public ActionResult Create(SongViewModel songViewModel) { byte[] audioFile = (byte[])TempData["AudioFile"]; TempData.Remove("AudioFile"); if (audioFile != null) { songViewModel.Song.AudioFile = audioFile; _songService.CreateSong(songViewModel.Song.ToBllSong()); return RedirectToAction("Index"); } return Json("file was not uploaded"); }
public ActionResult Details(int id) { SongViewModel songViewModel = new SongViewModel() { Artists = _songService.GetAllArtistsBySongId(id).ToMvcArtist(), Song = _songService.GetSongEntity(id).ToMvcSong(), Genres = _genreService.GetAllGenreEntities().ToMvcGenre() }; return View(songViewModel); }
public ActionResult Edit(SongViewModel songViewModel) { byte[] audioFile = (byte[])TempData["AudioFile"]; TempData.Remove("AudioFile"); songViewModel.Song.AudioFile = audioFile; _songService.UpdateSong(songViewModel.Song.ToBllSong()); _songService.SaveArtistsOfSong(songViewModel.Song.Id, songViewModel.ArtistsId); return RedirectToAction("Index"); }
public ActionResult Edit(int id) { SongViewModel songViewModel = new SongViewModel() { Song = _songService.GetSongEntity(id).ToMvcSong(), Artists = _artistService.GetAllArtistEntities().ToMvcArtist(), Genres = _genreService.GetAllGenreEntities().ToMvcGenre() }; return View(songViewModel); }