void deleteSubscriptionFromDB(object sender, DoWorkEventArgs e)
        {
            PodcastSubscriptionModel podcastModel = e.Argument as PodcastSubscriptionModel;

            using (var db = new PodcastSqlModel())
            {
                PodcastSubscriptionModel dbSubscription = db.Subscriptions.First(s => s.PodcastId == podcastModel.PodcastId);
                dbSubscription.cleanupForDeletion();
                db.deleteSubscription(dbSubscription);
            }

            e.Result = podcastModel;
        }
Exemple #2
0
        public async void deleteSubscription(PodcastSubscriptionModel podcastSubscriptionModel)
        {
            OnPodcastChannelDeleteStarted(this, null);

            await Task.Run(() =>
            {
                using (var db = new PodcastSqlModel())
                {
                    PodcastSubscriptionModel dbSubscription = db.Subscriptions.First(s => s.PodcastId == podcastSubscriptionModel.PodcastId);
                    dbSubscription.cleanupForDeletion();
                    db.deleteSubscription(dbSubscription);
                }
            });

            OnPodcastChannelDeleteFinished(this, null);
            OnPodcastChannelRemoved(podcastSubscriptionModel);
        }