public async Task <IActionResult> AddSongToPlaylist(Guid id, [FromBody] AddSongToPlaylist model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var playlist = await _service.GetPlaylistById(id, GetCurrentUserId()); if (playlist == null) { return(NotFound()); } var song = await _service.GetSongById(model.Id); if (song == null) { return(BadRequest("Unknown song")); } var playlistSong = await _service.AddSongToPlaylist(playlist, song.Song, GetCurrentUserId()); return(Ok(_mapper.Map <Song>(playlistSong))); }
private void Btn_AddPlaylist_Click(object sender, EventArgs e) { MyResources.Main.SetCursorLoading(); var add = new AddSongToPlaylist(); var s = MyResources.Resources.MsgSongs.FindSongByID(Convert.ToInt32((Tag as Dictionary <string, string>)["id"])); add.SetData(s); add.ShowDialog(); Lb_Name.Focus(); MyResources.Main.SetCursorDefault(); }