public async Task <IActionResult> Create(PlaylistGeneratorViewModel formInput) { if (!User.Identity.IsAuthenticated) { Response.Redirect("Login.aspx"); } int tripTime = await _bingMapsAPIService.FindDuration(formInput.StartLocation, formInput.EndLocation); var user = await _userManager.GetUserAsync(User); await _playlistService.GeneratePlaylist(tripTime, formInput.PlaylistName, formInput.Metal, formInput.Rock, formInput.Pop, formInput.TopTracks, formInput.SameArtist, user); return(RedirectToAction("Index")); }
public async Task <IActionResult> Create() { if (!User.Identity.IsAuthenticated) { Response.Redirect("Login.aspx"); } var genresDTOs = await _genreService.GetAllGenres(); var genresViewModels = genresDTOs.Select(x => x.ToViewModel()); var playlistGenerator = new PlaylistGeneratorViewModel(); playlistGenerator.Genres = genresViewModels.ToList(); return(View(playlistGenerator)); }