Пример #1
0
 public string CreateTap(string name, string kegId)
 {
     var id = _tapRepository.NextIdentity();
     var tap = new Tap(id, name);
     _tapRepository.Add(tap);
     tap.TapKeg(kegId);
     return id;
 }
Пример #2
0
 private BeerOnTap CreateBeerOnTap(Tap tap)
 {
     if (tap.HasKeg)
     {
         var keg = _kegRepository.GetById(tap.KegId);
         var beer = _beerRepository.GetById(keg.BeerId);
         var brewery = _breweryRepository.GetById(beer.BreweryId);
         var style = (string.IsNullOrEmpty(beer.StyleId)) ? null : _styleRepository.GetById(beer.StyleId);
         //TODO Maybe add a default color
         beer.Color = (null == style) ? string.Empty : style.Color;
         beer.Style = (null == style) ? string.Empty : style.Name;
         return new BeerOnTap() { Tap = tap, Keg = keg, Beer = beer, Brewery = brewery, Style = style };
     }
     else
     {
         return new BeerOnTap() { Tap = tap };
     }
 }
Пример #3
0
 public void Save(Tap tap)
 {
     _tapRepository.Update(tap);
 }