File tree 1 file changed +17
-2
lines changed
Zenergy/Zenergy/Controllers/ApiControllers
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 14
14
15
15
namespace Zenergy . Controllers . ApiControllers
16
16
{
17
+ [ RoutePrefix ( "api/events" ) ]
17
18
public class eventsController : ApiController
18
19
{
19
20
private ZenergyContext db = new ZenergyContext ( ) ;
20
-
21
21
22
- // GET: api/ponctualEvents
22
+
23
+ // GET: api/events/GetAllEventRegistrations
23
24
[ HttpGet ]
25
+ [ ActionName ( "GetAllEventRegistration" ) ]
26
+ [ Route ( "GetAllEventRegistration" ) ]
24
27
public IQueryable < @event > GetAllEventRegistrations ( )
25
28
{
26
29
return db . @event . Where ( e => e . user . Count != 0 ) ;
@@ -30,6 +33,8 @@ public IQueryable<@event> GetAllEventRegistrations()
30
33
//GET: api/events/GetRegistrationsByEvent?eventId=1
31
34
[ HttpGet ]
32
35
[ ResponseType ( typeof ( EventRegistrationModel ) ) ]
36
+ [ ActionName ( "GetRegistrationByEvent" ) ]
37
+
33
38
public async Task < IHttpActionResult > GetRegistrationsByEvent ( int eventId )
34
39
{
35
40
var myEvent = db . @event . Where ( e => e . eventId == eventId && e . user . Count != 0 ) ;
@@ -42,6 +47,16 @@ public async Task<IHttpActionResult> GetRegistrationsByEvent(int eventId)
42
47
}
43
48
44
49
50
+ [ HttpGet ]
51
+ [ ResponseType ( typeof ( @event ) ) ]
52
+ [ ActionName ( "SortByActivity" ) ]
53
+ [ Route ( "SortByActivity" ) ]
54
+ public IOrderedQueryable < @event > SortEventsByActivity ( )
55
+ {
56
+ return db . @event . OrderBy ( a => a . activity . activityName ) ;
57
+ }
58
+
59
+
45
60
46
61
47
62
/// <summary>
You can’t perform that action at this time.
0 commit comments