function ticketController($scope, $http) {
    $scope.responses = [];
    $scope.newItem = {};
    $scope.okMessage = null;
    $scope.errorMessage = null;
    $scope.isBusy = true;

    $scope.init = function (ticketId) {
        $scope.isBusy = true;
        $http.get('/api/TicketResponseApi/?ticketId=' + ticketId).then(function (result) {
            angular.copy(result.data, $scope.responses);
        },
        function () {
            alert('Error getting ticket responses!');
        }).then(function () {
            $scope.isBusy = false;
        });
    };

    $scope.addResponse = function () {
        $http.post('/api/TicketResponseApi/', $scope.newItem).then(function () {
            $scope.okMessage = "Erfolgreich hinzugefügt.";
        },
        function () {
            $scope.errorMessage = "Fehler beim Hinzufügen.";
        }).then(function () {
            $scope.isBusy = false;
        });
    };
}