// Delete all videos from playlist public static async Task <bool> Delete(ApplicationDbContext context, long PlayListID) { var entity = new JGN_Playlist_Videos { id = PlayListID }; context.JGN_Playlist_Videos.Attach(entity); context.JGN_Playlist_Videos.Remove(entity); await context.SaveChangesAsync(); PlayListBLL.Update_Video_Stat(context, PlayListID, 0); // update video statistic of play list return(true); }
public static async Task <bool> Add(ApplicationDbContext context, long playlid_id, long contentid) { var _entity = new JGN_Playlist_Videos() { id = playlid_id, contentid = contentid, created_at = DateTime.Now }; context.Entry(_entity).State = EntityState.Added; await context.SaveChangesAsync(); // update video statistics int count = await PlayList_VideosBLL.Count(context, playlid_id); // count total no of videos in current playlist PlayListBLL.Update_Video_Stat(context, playlid_id, count); // update video statistic of play list return(true); }