function ViewModel() {
    var self = this;
    self.deletePilotUrl = "/api/racesession/historic/";
    self.exportUrl = "/history/pdf/";
    self.sessions = ko.observableArray([]);
    self.deleteSession = function (raceSession) {
        $.ajax({
            type: "DELETE",
            url: self.deletePilotUrl + raceSession.id()
        });
        return false;
    };
    $.getJSON("/api/racesession/historic", function (allData) {
        var mappedSessions = $.map(allData.data, function (item) { return new RaceSession(item) });
        self.sessions(mappedSessions);
    });
    self.toggleIcon = function(e) {
        $(e).toggleClass("glyphicon-plus glyphicon-minus");
    };
    self.CreateExport = function(sessionId, exportType, e) {
        console.log(sessionId);
        console.log(exportType);
        $.ajax({
            type: "GET",
            url: self.exportUrl + sessionId,
            data: {
                exportType: exportType
            }
        });
    };
};
ko.applyBindings(new ViewModel());