public async Task <PlaylistDto> CreateNewPlaylist(PlaylistDto dto, Guid sessionId) { Database.Player currentPlayer = playerStore.GetLoggedPlayer(sessionId); if (currentPlayer.PersonnalPlaylists == null) { currentPlayer.PersonnalPlaylists = new List <Playlist>(); } if (currentPlayer.FavouritePlaylists == null) { currentPlayer.FavouritePlaylists = new List <PlayerFavouritePlaylist>(); } Playlist newPlaylist = new Database.Playlist { CreatedBy = currentPlayer, Description = dto.description, Name = dto.name }; currentPlayer.PersonnalPlaylists.Add(newPlaylist); dbContext.Update(currentPlayer); await dbContext.SaveChangesAsync(); dto.owner = new Owner { display_name = $"{currentPlayer.LastName + currentPlayer.FirstName}" }; dto.id = newPlaylist.Id.ToString(); playerStore.Refresh(currentPlayer); return(dto); }
private void detach_Playlists(Playlist entity) { this.SendPropertyChanging(); entity.User = null; }
partial void DeletePlaylist(Playlist instance);
private void attach_Playlists(Playlist entity) { this.SendPropertyChanging(); entity.User = this; }
partial void UpdatePlaylist(Playlist instance);
partial void InsertPlaylist(Playlist instance);