public static void UpdateBeer(Beer beerToUpdate, string newstyle, string newdistributor, string newbrewery)
        {
            using (AvalonContext context = new AvalonContext())
            {
                context.Beers.Attach(beerToUpdate);

                context.Entry(beerToUpdate).Reference(o => o.Style).Load();
                context.Entry(beerToUpdate).Reference(o => o.Brewery).Load();
                context.Entry(beerToUpdate).Reference(o => o.Distributor).Load();


                if (newstyle != String.Empty)
                {
                    Style newStyle = context.Styles.Where(s => s.Name == newstyle).Include("Beers").FirstOrDefault();
                    beerToUpdate.Style   = newStyle;
                    beerToUpdate.StyleId = newStyle.Id;
                }
                if (newdistributor != String.Empty)
                {
                    Distributor newDistributor = context.Distributors.Where(s => s.Name == newdistributor).Include("Breweries").Include("Beers").FirstOrDefault();
                    beerToUpdate.Distributor   = newDistributor;
                    beerToUpdate.DistributorId = newDistributor.Id;
                }
                if (newbrewery != String.Empty)
                {
                    Brewery newBrewery = context.Breweries.Where(s => s.Name == newbrewery).Include("Beers").Include("Distributors").FirstOrDefault();
                    beerToUpdate.Brewery   = newBrewery;
                    beerToUpdate.BreweryId = newBrewery.Id;
                }

                context.Entry(beerToUpdate).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
 public static void UpdateClient(Customer client)
 {
     using (var db = new AvalonContext())
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
     }
 }