public async Task <IActionResult> AddPlaylist(AddPlaylistFormViewModel vm)
        {
            string userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            var playlist = new PlayList
            {
                UserId = userId,
                Name   = vm.NewPlaylistName
            };

            _applicationDbContext.PlayLists.Add(playlist);
            await _applicationDbContext.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #2
0
        public AddPlayListForm(SongModel song)
        {
            InitializeComponent();
            ToggleForm();
            AddPLFormVM = new AddPlaylistFormViewModel(song);
            AddPLFormVM.ListPlaylistChange += AddPLFormVM_ListPlaylistChange;
            AddPLFormVM.ButtonStatusChange += AddPLFormVM_ButtonStatusChange;
            this.DataContext = AddPLFormVM;
            this.Closing    += AddPlayListForm_Closing;


            timer.Tick += Timer_Tick;
            timerUpdateButtonAddToPL.Tick += TimerUpdateButtonAddToPL_Tick;
            timer.Start();
        }