public static Spaceship CreateObjectFromAPI(ApiDataFetch dataFetch, int searchIndex)
        {
            SpaceshipData spaceshipData = dataFetch.GetSpaceShip(searchIndex);

            return(new Spaceship
            {
                Name = spaceshipData.name,
                Length = double.Parse(spaceshipData.length)
            });
        }
示例#2
0
        //Methods
        public PersonModel CreateModelFromAPI(ApiDataFetch dataFetch, int searchIndex)
        {
            PersonData personData = dataFetch.GetPerson(searchIndex);

            return(new PersonModel
            {
                Name = personData.name,
                Wallet = 300
            });
        }
 public ParkingService(int parkingSpaces)
 {
     this.apiDataFetch  = new ApiDataFetch();
     this.parkingSpaces = ParkingSpace.GetParkingSpaceAsync(parkingSpaces).Result.ToArray();
     if (ParkingSpace.GetParkingSpaceAsync(parkingSpaces).Result.ToArray().Count() < 1)
     {
         for (int i = 0; i < this.parkingSpaces.Length; i++)
         {
             this.parkingSpaces[i] = new ParkingSpace();
         }
     }
 }
示例#4
0
        public static Person CreateObjectFromAPI(ApiDataFetch dataFetch, int searchIndex)
        {
            PersonData personData = dataFetch.GetPerson(searchIndex);

            return(new Person(personData.name, 200));
        }