Beispiel #1
0
        public Beer updateBeer(BeerDTO newbeer)
        {
            var beerInDataBase = getBeerById(newbeer.id);

            if (beerInDataBase == null)
            {
                return(null);
            }

            beerInDataBase.Name             = newbeer.name;
            beerInDataBase.Tagline          = newbeer.tagline;
            beerInDataBase.FirstBrewed      = newbeer.first_brewed;
            beerInDataBase.Description      = newbeer.description;
            beerInDataBase.Abv              = newbeer.abv;
            beerInDataBase.Ibu              = newbeer.ibu;
            beerInDataBase.TargetFg         = newbeer.target_fg;
            beerInDataBase.TargetOg         = newbeer.target_og;
            beerInDataBase.Ebc              = newbeer.ebc;
            beerInDataBase.Srm              = newbeer.srm;
            beerInDataBase.Ph               = newbeer.ph;
            beerInDataBase.AttenuationLevel = newbeer.attenuation_level;
            beerInDataBase.Food             = null; //Sorry sé que después debo encontrar como hacerlo
            beerInDataBase.BrewersTips      = newbeer.brewers_tips;
            beerInDataBase.ContributedBy    = newbeer.contributed_by;

            dataBase.SaveChanges();

            return(beerInDataBase);
        }
Beispiel #2
0
 public int SaveChanges()
 {
     return(_beersContext.SaveChanges());
 }