Ejemplo n.º 1
0
 public async void SaveAsync(History entity)
 {
     using (var data = new PomodoroContext())
     {
         data.Stories.Add(entity);
         await data.SaveChangesAsync();
     }
 }
 private async void DeleteAsync()
 {
     using (var data = new PomodoroContext())
     {
         var configs = data.Configurations.ToList();
         data.Configurations.RemoveRange(configs);
         await data.SaveChangesAsync();
     }
 }
 public async void SaveAsync(Configuration config)
 {
     DeleteAsync();
     using (var data = new PomodoroContext())
     {
         data.Configurations.Add(config);
         await data.SaveChangesAsync();
     }
 }
Ejemplo n.º 4
0
 public async void DeleteStores()
 {
     using (var data = new PomodoroContext())
     {
         var entities = data.Stories.ToList();
         data.Stories.RemoveRange(entities);
         await data.SaveChangesAsync();
     }
 }
        public Configuration LoadAsync()
        {
            Configuration config = null;

            using (var data = new PomodoroContext())
            {
                config = data.Configurations.FirstOrDefault();
                if (config == null)
                {
                    config = LoadConfigDefault();
                }
            }

            return(config);
        }
Ejemplo n.º 6
0
        public List <History> AllAsync()
        {
            var stories = new List <History>();

            try
            {
                using (var data = new PomodoroContext())
                {
                    stories = data.Stories.ToList();
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            return(stories);
        }