Esempio n. 1
0
        public Task <ObservableRangeCollection <Models.Example> > ReadAll(string token = "")
        {
            FileStore fileStore = FileStore.EXAMPLES();

            ObservableRangeCollection <Models.Example> examples =
                Barrel.Current.Get <ObservableRangeCollection <Models.Example> >(fileStore.Value + token) ?? new ObservableRangeCollection <Models.Example>();

            return(Task.Run(() => examples));
        }
Esempio n. 2
0
        public Task <Models.Example> Insert(Models.Example example, TimeSpan expireIn, string token = "")
        {
            FileStore fileStore = FileStore.EXAMPLES();

            ObservableRangeCollection <Models.Example> examples =
                Barrel.Current.Get <ObservableRangeCollection <Models.Example> >(fileStore.Value + token) ?? new ObservableRangeCollection <Models.Example>();

            examples.Add(example);

            Barrel.Current.Add(fileStore.Value, SerializeObject(examples), expireIn);

            return(Task.Run(() => example));
        }