-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventService.cs
More file actions
43 lines (36 loc) · 1.45 KB
/
EventService.cs
File metadata and controls
43 lines (36 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using TaleEngine.Application.Contracts.Dtos;
using TaleEngine.Application.Contracts.Services;
using TaleEngine.Application.Mappers;
using TaleEngine.Bussiness.Contracts.DomainServices;
namespace TaleEngine.Application.Services
{
public class EventService : IEventService
{
private readonly IEventDomainService _eventDomainService;
private readonly IEditionService _editionService;
public EventService(IEventDomainService eventDomainService,
IEditionService editionService)
{
_eventDomainService = eventDomainService ?? throw new ArgumentNullException(nameof(eventDomainService));
_editionService = editionService ?? throw new ArgumentNullException(nameof(editionService));
}
public List<EventDto> GetAllEvents()
{
var events = _eventDomainService.GetEventsNoFilter();
var result = EventMapper.Map(events);
return result;
}
public int GetCurrentOrLastEdition(int selectedEvent)
{
int lastOrCurrentEdition = _editionService.GetCurrentOrLastEdition(selectedEvent);
return lastOrCurrentEdition;
}
public EventDto GetEvent(int eventId)
{
var selectedEvent = _eventDomainService.GetEvent(eventId);
return EventMapper.Map(selectedEvent);
}
}
}