Example #1
0
 public async Task <Volume> GetAsync(int id)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.Volume.FindAsync(id));
     }
 }
Example #2
0
 public async Task <FoodPairing> GetAsync(int id)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.FoodPairing.FindAsync(id));
     }
 }
Example #3
0
 public async Task <Ingredient> GetAsync(int id)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.Ingredient.FindAsync(id));
     }
 }
Example #4
0
 public async Task ImportAsync(IEnumerable <Beer> beerList)
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         await dbContext.BulkInsertOrUpdateAsync(beerList.ToList());
     }
 }
Example #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());
     }
 }
Example #6
0
 public async Task <IEnumerable <Beer> > ListAsync()
 {
     using (var dbContext = new Upstart13beerappContext())
     {
         return(await dbContext.Beer.ToListAsync());
     }
 }
Example #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();
            }
        }
Example #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();
            }
        }
Example #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();
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #12
0
        public async Task <Volume> AddAsync(Volume volume)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Volume.AddAsync(volume);

                await dbContext.SaveChangesAsync();

                return(volume);
            }
        }
Example #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);
            }
        }
Example #14
0
        public async Task <Ingredient> AddAsync(Ingredient ingredient)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Ingredient.AddAsync(ingredient);

                await dbContext.SaveChangesAsync();

                return(ingredient);
            }
        }
Example #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);
            }
        }
Example #16
0
        public async Task <FoodPairing> AddAsync(FoodPairing foodPairing)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.FoodPairing.AddAsync(foodPairing);

                await dbContext.SaveChangesAsync();

                return(foodPairing);
            }
        }
Example #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);
            }
        }
Example #18
0
        public async Task <Beer> AddAsync(Beer beer)
        {
            using (var dbContext = new Upstart13beerappContext())
            {
                await dbContext.Beer.AddAsync(beer);

                await dbContext.SaveChangesAsync();

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

                await dbContext.SaveChangesAsync();

                return(method);
            }
        }