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

                await dbContext.SaveChangesAsync();

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

                await dbContext.SaveChangesAsync();

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

                await dbContext.SaveChangesAsync();

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

                await dbContext.SaveChangesAsync();

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

                await dbContext.SaveChangesAsync();

                return(method);
            }
        }