Пример #1
0
 public ActionResult Create()
 {
     SongViewModel songViewModel = new SongViewModel()
     {
         Artists = _artistService.GetAllArtistEntities().ToMvcArtist(),
         Genres = _genreService.GetAllGenreEntities().ToMvcGenre()
     };
     return View(songViewModel);
 }
Пример #2
0
 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");
 }
Пример #3
0
 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);
 }
Пример #4
0
 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");
 }
Пример #5
0
 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);
 }