Example #1
0
 public PlanetService(ILogger <PlanetService> logger, IPlanetRepository planetRepository)
 {
     _logger           = logger;
     _planetRepository = planetRepository;
     _planetRepository.AddPlanet(new Planet {
         PlanetId        = 1,
         PlanetName      = "Test Planet",
         AdjacentPlanets = new List <AdjacentPlanet>()
         {
             new AdjacentPlanet()
             {
                 PlanetId = 2,
                 Distance = 10
             }
         },
         Market = new PlanetMarket()
         {
             ProductionItems = new List <ProductionItem>()
             {
                 new ProductionItem()
                 {
                     ItemId          = 1,
                     ItemName        = "Box",
                     ProducedPerHour = 1000,
                     BaseValue       = 1,
                     Amount          = 0,
                     MaxAmount       = 10000
                 }
             },
             ConsumableItems = new List <ConsumableItem>()
             {
                 new ConsumableItem()
                 {
                     ItemId          = 2,
                     ItemName        = "Food",
                     ConsumedPerHour = 1000,
                     BaseValue       = 2,
                     Amount          = 0,
                     MaxAmount       = 20000
                 },
                 new ConsumableItem()
                 {
                     ItemId          = 3,
                     ItemName        = "Metal",
                     ConsumedPerHour = 2000,
                     BaseValue       = 10,
                     Amount          = 0,
                     MaxAmount       = 5000
                 }
             },
             LastUpdate = DateTime.Now
         }
     });
 }
Example #2
0
        public async Task <bool> AddPlanet(Planet planet)
        {
            await _planetRepository.AddPlanet(planet);

            return(true);
        }