public static bool Delete(RankingGenre genre) { var db = HohoemaLiteDb.GetLocalLiteRepository(); var genreCode = genre.ToString(); return(db.Delete <RankingGenreTagsInfo>(x => x.GenreCode == genreCode) > 0); }
public static IEnumerable <Models.Subscription.Subscription> GetOrderedSubscriptions() { var db = HohoemaLiteDb.GetLocalLiteRepository(); var items = db.Fetch <SubscriptionData>() .OrderBy(x => x.Order) .Select(x => { var subsc = new Models.Subscription.Subscription( x.Id, x.Label ); subsc.IsEnabled = x.IsEnabled; foreach (var source in x.Sources ?? Enumerable.Empty <SubsciptionSourceData>()) { subsc.Sources.Add(new Models.Subscription.SubscriptionSource(source.Label, source.SourceType, source.Parameter, source.OptionalLabel)); } foreach (var dest in x.Destinations ?? Enumerable.Empty <SubscriptionDestinationData>()) { subsc.Destinations.Add(new Models.Subscription.SubscriptionDestination(dest.Label, dest.Target, dest.PlaylistId)); } subsc.DoNotNoticeKeyword = x.DoNotNoticeKeyword; subsc.DoNotNoticeKeywordAsRegex = x.DoNotNoticeKeywordAsRegex; return(subsc); } ) .ToArray(); return(items); }
public static void AddOrUpdateSubscription(Models.Subscription.Subscription subscription, int order) { var db = HohoemaLiteDb.GetLocalLiteRepository(); var data = db.SingleOrDefault <SubscriptionData>(x => x.Id == subscription.Id) ?? new SubscriptionData(); data.Id = subscription.Id == default(Guid) ? Guid.NewGuid() : subscription.Id; data.Label = subscription.Label; data.IsEnabled = subscription.IsEnabled; data.Order = order; data.Sources = subscription.Sources.Select(x => new SubsciptionSourceData() { Label = x.Label, OptionalLabel = x.OptionalLabel, SourceType = x.SourceType, Parameter = x.Parameter }) .ToList(); data.Destinations = subscription.Destinations.Select(x => new SubscriptionDestinationData() { Label = x.Label, Target = x.Target, PlaylistId = x.PlaylistId }) .ToList(); data.DoNotNoticeKeyword = subscription.DoNotNoticeKeyword; data.DoNotNoticeKeywordAsRegex = subscription.DoNotNoticeKeywordAsRegex; db.Upsert(data); }
public static bool Upsert(RankingGenre genre, IEnumerable <RankingGenreTag> tags) { var db = HohoemaLiteDb.GetLocalLiteRepository(); db.Upsert(new RankingGenreTagsInfo() { GenreCode = genre.ToString(), Tags = tags.ToList(), UpdateAt = DateTime.Now }); return(true); }
public static RankingGenreTagsInfo Get(RankingGenre genre) { if (genre == RankingGenre.All) { return(null); } var db = HohoemaLiteDb.GetLocalLiteRepository(); var genreCode = genre.ToString(); return(db.SingleOrDefault <RankingGenreTagsInfo>(x => x.GenreCode == genreCode)); }
static public bool Remove(LocalMylistData localMylist) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Delete <LocalMylistData>(x => x.Id == localMylist.Id) > 0); }
static public void AddOrUpdate(LocalMylistData localMylist) { var db = HohoemaLiteDb.GetLocalLiteRepository(); db.Upsert(localMylist); }
static public LocalMylistData Get(string id) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.SingleById <LocalMylistData>(id)); }
static public List <LocalMylistData> GetLocalMylistGroups() { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Fetch <LocalMylistData>()); }
public static bool RemoveSubscription(Models.Subscription.Subscription subscription) { var db = HohoemaLiteDb.GetLocalLiteRepository(); return(db.Delete <SubscriptionData>(x => x.Id == subscription.Id) > 0); }