// GET: Admin/Songs/Create public ActionResult Create() { var songViewModel = new SongSubmitViewModel(); songViewModel.Genres = this.genreService.GetAll().ProjectTo <GenreViewModel>().ToList(); return(View(songViewModel)); }
public ActionResult Edit(SongSubmitViewModel songViewModel) { if (ModelState.IsValid) { this.songService.Update(songViewModel.Id, songViewModel.GenreId, songViewModel.Name, songViewModel.Minutes * 60 + songViewModel.Seconds); return(RedirectToAction("All")); } return(View(songViewModel)); }
public ActionResult Create(SongSubmitViewModel songViewModel, Guid albumId) { if (ModelState.IsValid) { this.songService.AddSong(songViewModel.Name, songViewModel.Minutes * 60 + songViewModel.Seconds, songViewModel.GenreId, albumId); return(RedirectToAction("All")); } return(View(songViewModel)); }
// GET: Admin/Songs/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SongSubmitViewModel songSubmitViewModel = this.mapper.Map <SongSubmitViewModel>(this.songService.GetById((Guid)id)); songSubmitViewModel.Genres = this.genreService.GetAll().ProjectTo <GenreViewModel>().ToList(); return(View(songSubmitViewModel)); }