public Beer AddBeer(string name, double?alcoholByVolume = null, decimal price = 0, string description = null) { if (name != null && Beers.Any(b => b.Name == name)) { throw new ArgumentException($"Brewer {Name} has already a beer by the name of {name}"); } Beer newBeer = new Beer(name) { AlcoholByVolume = alcoholByVolume, Description = description, Price = price }; Beers.Add(newBeer); return(newBeer); }
public void AddBeer(Beer beer) { beer.BeerId = Beers.Any() ? Beers.Max(b => b.BeerId) + 1 : 1; Beers.Add(beer); }