コード例 #1
0
        private void AddCheckin(Checkin checkin, CheckinsContainer checkinsContainer)
        {
            Beer beer = checkinsContainer.GetBeer(checkin.Beer.Id);

            if (beer == null)
            {
                beer = checkin.Beer;
                Brewery brewery = checkinsContainer.GetBrewery(beer.Brewery.Id);
                if (brewery == null)
                {
                    brewery = beer.Brewery;
                    Venue venue = brewery.Venue;
                    if (IsUpdateVenue(ref venue, checkinsContainer))
                    {
                        brewery.Venue = venue;
                    }

                    checkinsContainer.AddBrewery(brewery);
                }
                else
                {
                    beer.Brewery = brewery;
                }
                checkinsContainer.AddBeer(beer);
            }
            else
            {
                checkin.Beer = beer;
            }

            FillCheckinVenue(checkin, checkinsContainer);
            checkinsContainer.AddCheckin(checkin);
        }
コード例 #2
0
 private static void FillBeer(Beer beer, BeerWeb beerWeb)
 {
     beer.Id       = beerWeb.Bid;
     beer.Name     = beerWeb.BeerName;
     beer.Type     = beerWeb.BeerStyle;
     beer.ABV      = beerWeb.BeerAbv;
     beer.Url      = $"{UriConstants.BaseUri}beer/{beerWeb.Bid}";
     beer.LabelUrl = beerWeb.BeerLabel.ToString();
 }