Skip to content

Commit df6be1c

Browse files
committed
SortByActivity OK
1 parent 9ad65df commit df6be1c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Diff for: Zenergy/Zenergy/Controllers/ApiControllers/eventsController.cs

+17-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414

1515
namespace Zenergy.Controllers.ApiControllers
1616
{
17+
[RoutePrefix("api/events")]
1718
public class eventsController : ApiController
1819
{
1920
private ZenergyContext db = new ZenergyContext();
20-
2121

22-
// GET: api/ponctualEvents
22+
23+
// GET: api/events/GetAllEventRegistrations
2324
[HttpGet]
25+
[ActionName("GetAllEventRegistration")]
26+
[Route("GetAllEventRegistration")]
2427
public IQueryable<@event> GetAllEventRegistrations()
2528
{
2629
return db.@event.Where(e => e.user.Count != 0);
@@ -30,6 +33,8 @@ public IQueryable<@event> GetAllEventRegistrations()
3033
//GET: api/events/GetRegistrationsByEvent?eventId=1
3134
[HttpGet]
3235
[ResponseType(typeof(EventRegistrationModel))]
36+
[ActionName("GetRegistrationByEvent")]
37+
3338
public async Task<IHttpActionResult> GetRegistrationsByEvent(int eventId)
3439
{
3540
var myEvent = db.@event.Where(e => e.eventId == eventId && e.user.Count != 0);
@@ -42,6 +47,16 @@ public async Task<IHttpActionResult> GetRegistrationsByEvent(int eventId)
4247
}
4348

4449

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+
4560

4661

4762
/// <summary>

0 commit comments

Comments
 (0)