コード例 #1
0
ファイル: AirportService.cs プロジェクト: PaxillusIT/airport
        public async Task Create(Airport airport)
        {
            var airportAggregate = new Domain.Airport(Guid.NewGuid());

            airportAggregate.SetIata(airport.Iata);
            if (airport.Lon.HasValue && airport.Lat.HasValue)
            {
                airportAggregate.SetCoordinates(airport.Lat.Value, airport.Lon.Value);
            }

            if (airport.Status)
            {
                airportAggregate.Enable();
            }
            else
            {
                airportAggregate.Disable();
            }

            airportAggregate.SetLocation(airport.Continent, airport.Iso);
            airportAggregate.SetName(airport.Name);
            airportAggregate.SetSize(airport.Size);
            airportAggregate.SetType(airport.Type);

            await _airportRepository.Save(airportAggregate);
        }