Exemple #1
0
 public async Task <Volume> GetAsync(int id)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.Volume.FindAsync(id));
     }
 }
Exemple #2
0
 public async Task <FoodPairing> GetAsync(int id)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.FoodPairing.FindAsync(id));
     }
 }
Exemple #3
0
 public async Task <Ingredient> GetAsync(int id)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.Ingredient.FindAsync(id));
     }
 }
Exemple #4
0
 public async Task ImportAsync(IEnumerable <Beer> beerList)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         await dbContext.BulkInsertOrUpdateAsync(beerList.ToList());
     }
 }
Exemple #5
0
 public async Task <IEnumerable <Volume> > ListAsync(int beerId)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await(from c in dbContext.Volume where c.BeerId == beerId select c).ToListAsync());
     }
 }
Exemple #6
0
 public async Task <IEnumerable <Beer> > ListAsync()
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.Beer.ToListAsync());
     }
 }
Exemple #7
0
        public async Task DeleteAsync(int id)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                var ingredientToDelete = await GetAsync(id);

                dbContext.Ingredient.Remove(ingredientToDelete);
                await dbContext.SaveChangesAsync();
            }
        }
Exemple #8
0
        public async Task DeleteAsync(int id)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                var volumeToDelete = await GetAsync(id);

                dbContext.Volume.Remove(volumeToDelete);
                await dbContext.SaveChangesAsync();
            }
        }
Exemple #9
0
        public async Task DeleteAsync(int id)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                var foodPairingToDelete = await GetAsync(id);

                dbContext.FoodPairing.Remove(foodPairingToDelete);
                await dbContext.SaveChangesAsync();
            }
        }
Exemple #10
0
        public async Task <Method> UpdateAsync(Method method)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                dbContext.Attach(method);
                dbContext.Entry(method).State = EntityState.Modified;
                await dbContext.SaveChangesAsync();

                return(method);
            }
        }
Exemple #11
0
        public async Task <Volume> UpdateAsync(Volume volume)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                dbContext.Attach(volume);
                dbContext.Entry(volume).State = EntityState.Modified;
                await dbContext.SaveChangesAsync();

                return(volume);
            }
        }
Exemple #12
0
        public async Task <Volume> AddAsync(Volume volume)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Volume.AddAsync(volume);

                await dbContext.SaveChangesAsync();

                return(volume);
            }
        }
Exemple #13
0
        public async Task <Beer> UpdateAsync(Beer beer)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                dbContext.Attach(beer);
                dbContext.Entry(beer).State = EntityState.Modified;
                await dbContext.SaveChangesAsync();

                return(beer);
            }
        }
Exemple #14
0
        public async Task <Ingredient> AddAsync(Ingredient ingredient)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Ingredient.AddAsync(ingredient);

                await dbContext.SaveChangesAsync();

                return(ingredient);
            }
        }
Exemple #15
0
        public async Task <FoodPairing> UpdateAsync(FoodPairing foodPairing)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                dbContext.Attach(foodPairing);
                dbContext.Entry(foodPairing).State = EntityState.Modified;
                await dbContext.SaveChangesAsync();

                return(foodPairing);
            }
        }
Exemple #16
0
        public async Task <FoodPairing> AddAsync(FoodPairing foodPairing)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.FoodPairing.AddAsync(foodPairing);

                await dbContext.SaveChangesAsync();

                return(foodPairing);
            }
        }
Exemple #17
0
        public async Task <Ingredient> UpdateAsync(Ingredient ingredient)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                dbContext.Attach(ingredient);
                dbContext.Entry(ingredient).State = EntityState.Modified;
                await dbContext.SaveChangesAsync();

                return(ingredient);
            }
        }
Exemple #18
0
        public async Task <Beer> AddAsync(Beer beer)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Beer.AddAsync(beer);

                await dbContext.SaveChangesAsync();

                return(beer);
            }
        }
Exemple #19
0
        public async Task <Method> AddAsync(Method method)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Method.AddAsync(method);

                await dbContext.SaveChangesAsync();

                return(method);
            }
        }