Ejemplo n.º 1
0
        public async Task DeleteAsync(Exercise exercise)
        {
            if (exercise == null)
            {
                return;
            }

            using RepCounterDbContext dbContext = new RepCounterDbContext(DbContextOptions);
            dbContext.Exercises.Remove(exercise);
            await dbContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task DeleteAsync(IEnumerable <Exercise> exercises)
        {
            if (exercises == null)
            {
                return;
            }

            using RepCounterDbContext dbContext = new RepCounterDbContext(DbContextOptions);
            foreach (Exercise exercise in exercises)
            {
                if (exercise != null)
                {
                    dbContext.Exercises.Remove(exercise);
                }
            }
            await dbContext.SaveChangesAsync();
        }
Ejemplo n.º 3
0
 public async Task <Exercise> GetAsync(long exerciseId)
 {
     using RepCounterDbContext dbContext = new RepCounterDbContext(DbContextOptions);
     return(await dbContext.Exercises.FindAsync(exerciseId));
 }
Ejemplo n.º 4
0
 public async Task <IEnumerable <Exercise> > GetAllAsync()
 {
     using RepCounterDbContext dbContext = new RepCounterDbContext(DbContextOptions);
     return(await dbContext.Exercises.ToListAsync());
 }
 public async Task <IEnumerable <WeightUnit> > GetAllAsync()
 {
     using RepCounterDbContext dbContext = new RepCounterDbContext(DbContextOptions);
     return(await dbContext.WeightUnits.ToListAsync());
 }