// Delete single video from playlist public static async Task <bool> Delete(ApplicationDbContext context, long PlayListID, long VideoID) { var all = from c in context.JGN_Playlist_Videos where c.id == PlayListID && c.contentid == VideoID select c; context.JGN_Playlist_Videos.RemoveRange(all); await context.SaveChangesAsync(); // update video statistics int count = await PlayList_VideosBLL.Count(context, PlayListID); // count total no of videos in current playlist PlayListBLL.Update_Video_Stat(context, PlayListID, count); // update video statistic of play list return(true); }
public static async Task <bool> Delete(ApplicationDbContext context, long playlid_id) { await PlayList_VideosBLL.Delete(context, playlid_id); var entity = new JGN_User_Playlists { id = playlid_id }; context.JGN_User_Playlists.Attach(entity); context.JGN_User_Playlists.Remove(entity); await context.SaveChangesAsync(); 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); }