Exemple #1
0
        public async Task UpdateBrand(string id, BrandBinding binding)
        {
            using (var context = GetMainContext())
            {
                var brand = await context.BeerBrands.SingleOrDefaultAsync(x => x.ValueId == id);

                var entity = binding.ToEntity(context, brand);

                await context.SaveChangesAsync();
            }
        }
Exemple #2
0
        public async Task <string> CreateBrand(BrandBinding binding)
        {
            using (var context = GetMainContext())
            {
                var entity = binding.ToEntity(context);

                await context.BeerBrands.AddAsync(entity);

                await context.SaveChangesAsync();

                return(entity.ValueId);
            }
        }