/// <summary> /// 根据频道ID删除一个追剧 /// </summary> /// <param name="chanelId"></param> public void RemoveByChannelId(int channelId) { var pursuitInfo = DataInfos.FirstOrDefault(p => p.ChannelId == channelId); if (pursuitInfo != null) { RemoveEntity(pursuitInfo); } }
public void RemoveEntity(int channelId) { var item = DataInfos.FirstOrDefault(watch => watch.VID == channelId); if (item != null) { RemoveEntity(item); } }
/// <summary> /// 更新指定频道的集数 /// </summary> /// <param name="channelId"></param> /// <param name="count"></param> public void UpdateCountByChannelId(int channelId, int count) { var pursuitInfo = DataInfos.FirstOrDefault(p => p.ChannelId == channelId); if (pursuitInfo != null) { pursuitInfo.ChannelCount = count; SubmitDatabase(); } }
/// <summary> /// 根据频道ID删除一个追剧,但不保存至CE数据库 /// </summary> /// <param name="channelId"></param> public void RemoveNotSave(int channelId) { var pursuitInfo = DataInfos.FirstOrDefault(p => p.ChannelId == channelId); if (pursuitInfo != null) { DataInfos.Remove(pursuitInfo); DataContext.PursuitTable.DeleteOnSubmit(pursuitInfo); } }
/// <summary> /// 新增一条记录 /// </summary> /// <param name="entity"></param> public override void AddEntity(DBWatchHistoryChanneInfo entity) { var item = DataInfos.FirstOrDefault(watch => watch.VID == entity.VID); if (item != null) { DataInfos.Remove(item); _table.DeleteOnSubmit(item); } DataInfos.Insert(0, entity); _table.InsertOnSubmit(entity); SubmitDatabase(); }
/// <summary> /// 新增一条搜索历史记录,如果存在则更新 /// </summary> /// <param name="entity"></param> public override void AddEntity(DBHistorySearchInfo entity) { var item = DataInfos.FirstOrDefault(o => o.Key == entity.Key); if (item != null) { DataInfos.Remove(item); _table.DeleteOnSubmit(item); } _table.InsertOnSubmit(entity); DataInfos.Insert(0, entity); SubmitDatabase(); }
/// <summary> /// 根据ID删除一条记录,并POST到云端 /// </summary> /// <param name="vid"></param> /// <returns></returns> public void DeleteRecord(int vid) { var local = DataInfos.FirstOrDefault(v => v.Id == vid); if (local != null) { local.DataType = CloudInfoEnum.Delete; _postFactory.AddDeleteInfo(local); PostChange(); base.DeleteRecord(local); if (LocalChangeAction != null) { LocalChangeAction(); } } }
/// <summary> /// 根据频道ID返回一条记录,如果不存在则返回null /// </summary> /// <param name="vid"></param> /// <returns></returns> public async Task <CloudDataInfo> GetRecord(int vid) { return(await Task.Run(() => { return DataInfos.FirstOrDefault(v => v.Id == vid); })); }
/// <summary> /// 根据频道ID返回观看历史记录 /// </summary> /// <param name="channelId"></param> /// <returns></returns> public DBWatchHistoryChanneInfo GetEntity(int channelId) { return(DataInfos.FirstOrDefault(watch => watch.VID == channelId)); }
public SocialDataInfo GetRecord(SocialType socialType) { return(DataInfos.FirstOrDefault(v => v.Type == socialType)); }
/// <summary> /// 确定是否追了该剧 /// </summary> /// <param name="channelId"></param> /// <returns></returns> public bool HasByChannelId(int channelId) { var pursuit = DataInfos.FirstOrDefault(p => p.ChannelId == channelId); return(pursuit == null ? false : true); }
/// <summary> /// 返回指定频道ID的追剧信息 /// </summary> /// <param name="channelId"></param> /// <returns></returns> public PursuitInfo GetByChannelId(int channelId) { return(DataInfos.FirstOrDefault(p => p.ChannelId == channelId)); }