import { Injectable } from '@angular/core';
import { Athlete } from './Athlete';
import { Http, Response } from "@angular/http";
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';

@Injectable()
export class AthleteService {
  constructor(private http: Http){}

  getAthletes(){
    return this.http.get('http://localhost:57663/api/athletes')
      .map((r: Response)=><Athlete[]>r.json().data)
      .toPromise();
  }
}