Bulk-Commit: Darft: Anmeldetool.
Interface Definition: done Server-Side-Implementation: partly done (CR missing, potential Refactor, ...) Client-Side-Implementation: started: (UI: done, Service: started, but works with SSR) Missing: Permissions / Roles to restrict access to an event. Missing: Fields on Event. Missing: Good Styling Time-Took: about 12 Hours. Learning: Commit in smaller packets, rest will be discussed at CR
This commit is contained in:
@ -2,8 +2,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
||||
|
||||
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
{
|
||||
@ -13,7 +15,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
|
||||
private string Apiurl => CreateApiUrl("EventRegistration");
|
||||
|
||||
public async Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
||||
/*public async Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
||||
{
|
||||
List<Models.Event> EventRegistrations = await GetJsonAsync<List<Models.Event>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Models.Event>().ToList());
|
||||
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
||||
@ -32,11 +34,51 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||
public async Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration)
|
||||
{
|
||||
return await PutJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
||||
}*/
|
||||
|
||||
public async Task<List<Event>> GetEventsAsync(int ModuleId)
|
||||
{
|
||||
List<Event> EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Event>().ToList());
|
||||
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
public async Task<Event> GetEventAsync(int EventId, int ModuleId)
|
||||
{
|
||||
return await GetJsonAsync<Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventId}/{ModuleId}", EntityNames.Module, ModuleId));
|
||||
}
|
||||
|
||||
public async Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||
public async Task<Event> AddEventAsync(Event NewEvent)
|
||||
{
|
||||
await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistrationId}/{ModuleId}", EntityNames.Module, ModuleId));
|
||||
return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}", EntityNames.Module, NewEvent.ModuleId), NewEvent);
|
||||
}
|
||||
|
||||
public async Task<Event> UpdateEventAsync(Event NewEvent)
|
||||
{
|
||||
return await PutJsonAsync<Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{NewEvent.EventId}", EntityNames.Module, NewEvent.ModuleId), NewEvent);
|
||||
}
|
||||
|
||||
public async Task DeleteEventAsync(int EventId, int ModuleId)
|
||||
{
|
||||
await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventId}/{ModuleId}", EntityNames.Module, ModuleId));
|
||||
}
|
||||
|
||||
public async Task<Response> AddResponseAsync(Response response)
|
||||
{
|
||||
return await PostJsonAsync<Response>(CreateAuthorizationPolicyUrl($"{Apiurl}/response/{response.EventRegistrationId}/{response.ModuleId}", EntityNames.Module, response.ModuleId), response);
|
||||
}
|
||||
|
||||
public async Task<Response> UpdateResponseAsync(Response response)
|
||||
{
|
||||
return await PutJsonAsync<Response>(CreateAuthorizationPolicyUrl($"{Apiurl}/response/{response.EventRegistrationId}/{response.ModuleId}", EntityNames.Module, response.ModuleId), response);
|
||||
}
|
||||
|
||||
public async Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId)
|
||||
{
|
||||
return await GetJsonAsync<(Event, Response)>(CreateAuthorizationPolicyUrl($"{Apiurl}/details/{EventId}/{ModuleId}", EntityNames.Module, ModuleId));
|
||||
}
|
||||
|
||||
public Task<List<Response>> GetEventResponses(int EventId, int ModuleId)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user