Пример #1
0
        public CcAddSubscriptionResponse AddSubscription(CcAddSubscriptionRequest request)
        {
            var connection = new SqliteConnection(Settings.SQLiteConnectionString);
            PersistenceStorage.PersistentDataContext context = new PersistenceStorage.PersistentDataContext(connection);

            PersistenceStorage.Subscription subscription = new PersistenceStorage.Subscription();
            subscription.Type = request.Subscription.Type;
            subscription.AccessKey = request.Subscription.AccessKey;
            subscription.SecretKey = request.Subscription.SecretKey;
            subscription.State = request.Subscription.State;
            subscription.CreatedDate = request.Subscription.CreatedDate;

            List<PersistenceStorage.SubscriptionItem> items = TransformSubscriptionItems(request.Subscription.Items);
            subscription.SubscriptionItem.AddRange(items);

            context.Subscription.InsertOnSubmit(subscription);
            context.SubmitChanges();

            CcAddSubscriptionResponse response = new CcAddSubscriptionResponse();
            return response;
        }
Пример #2
0
        public CcAddSubscriptionResponse AddSubscription(CcAddSubscriptionRequest request)
        {
            var connection = new SqliteConnection(Settings.SQLiteConnectionString);

            PersistenceStorage.PersistentDataContext context = new PersistenceStorage.PersistentDataContext(connection);

            PersistenceStorage.Subscription subscription = new PersistenceStorage.Subscription();
            subscription.Type        = request.Subscription.Type;
            subscription.AccessKey   = request.Subscription.AccessKey;
            subscription.SecretKey   = request.Subscription.SecretKey;
            subscription.State       = request.Subscription.State;
            subscription.CreatedDate = request.Subscription.CreatedDate;

            List <PersistenceStorage.SubscriptionItem> items = TransformSubscriptionItems(request.Subscription.Items);

            subscription.SubscriptionItem.AddRange(items);

            context.Subscription.InsertOnSubmit(subscription);
            context.SubmitChanges();

            CcAddSubscriptionResponse response = new CcAddSubscriptionResponse();

            return(response);
        }