Skip to content

Commit dbba7ce

Browse files
committed
join features test
1 parent d6f6e7d commit dbba7ce

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Diff for: Zenergy/Zenergy/Pages/eventRegistration.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ <h2>{{dateSelected}}</h2>
1212
<th>Time</th>
1313
<th>Name</th>
1414
<th>Room</th>
15+
<th>Activity</th>
1516
<th>Price</th>
1617
<th>Register</th>
1718
</tr>
1819
<tr ng-repeat="e in events">
1920
<td>{{e.timeBegin}}</td>
2021
<td>{{e.name}}</td>
2122
<td>{{e.roomName}}</td>
23+
<td>{{e.activity}}</td>
2224
<td>{{e.price}}</td>
23-
<td> <button onclick="" class="btn btn-default" ng-if="!pastevent">Join</button></td>
25+
<td> <button ng-click="joinEvent(e.Id)" class="btn btn-default" ng-if="!pastevent">Join</button></td>
2426

2527
</tr>
2628

Diff for: Zenergy/Zenergy/Scripts/Controllers/eventRegistrationPageController.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
zenergyApp.controller("eventRegistrationPageController", ["$scope", "$http", "$window", "$location", function ($scope, $http, $window, $location) {
1+
zenergyApp.controller("eventRegistrationPageController", ["$scope", "$http", "tokenService", "$window", "$location", function ($scope, $http, tokenService, $window, $location) {
22

33
$scope.pastevent = false;
44
//date format
@@ -52,6 +52,7 @@
5252
duration: responseEvent.data[e].event.eventDurationHours,
5353
price: responseEvent.data[e].event.eventPrice,
5454
name: responseEvent.data[e].event.eventName,
55+
activity: responseEvent.data[e].event.activity.activityName
5556
});
5657
}
5758
}
@@ -62,6 +63,19 @@
6263
});
6364

6465
};
66+
//Register to the event
67+
$scope.joinEvent = function (eventid) {
68+
// reister to an event
69+
var responseEvent = $http({
70+
url: 'api/users/' + tokenService.getUserId() + '/events/' + eventid + '/registration',
71+
method: 'POST',
72+
headers: {
73+
'Content-Type': 'application/json'
74+
}
75+
}).then(function successCallback(responseEvent) {
76+
bootbox.alert("You just join this event !");
77+
});
78+
};
6579

6680
$scope.getEvent();
6781

0 commit comments

Comments
 (0)