| | | 1 | | /* |
| | | 2 | | * eventListServices.cs |
| | | 3 | | * event-list |
| | | 4 | | * |
| | | 5 | | * Created by Tiago Amaral on 06/09/2025. |
| | | 6 | | * Copyright ©2024 Tiago Amaral. All rights reserved. |
| | | 7 | | */ |
| | | 8 | | |
| | | 9 | | using event_list.modules.eventlist.storage; |
| | | 10 | | namespace event_list.modules.eventlist.services; |
| | | 11 | | public class EventListServices : IEventListServices |
| | | 12 | | { |
| | | 13 | | |
| | | 14 | | private readonly IEventListDeleteByIdentifierService _deleteService; |
| | | 15 | | private readonly IEventListFetchByIdentifierService _fetchByIdService; |
| | | 16 | | private readonly IEventListFetchService _fetchService; |
| | | 17 | | private readonly IEventListSaveService _saveService; |
| | | 18 | | |
| | 14 | 19 | | public EventListServices(IEventListDeleteByIdentifierService deleteService, |
| | 14 | 20 | | IEventListFetchByIdentifierService fetchByIdService, |
| | 14 | 21 | | IEventListFetchService fetchService, |
| | 14 | 22 | | IEventListSaveService saveService) |
| | 14 | 23 | | { |
| | 14 | 24 | | this._deleteService = deleteService; |
| | 14 | 25 | | this._fetchByIdService = fetchByIdService; |
| | 14 | 26 | | this._fetchService = fetchService; |
| | 14 | 27 | | this._saveService = saveService; |
| | 14 | 28 | | } |
| | | 29 | | |
| | | 30 | | |
| | | 31 | | public async Task CreateAsync(EventFormDto dto) |
| | 2 | 32 | | { |
| | 2 | 33 | | await this._saveService.Add(dto); |
| | 1 | 34 | | } |
| | | 35 | | |
| | 3 | 36 | | public async Task DeleteAsync(Guid id) => await this._deleteService.Delete(id); |
| | | 37 | | |
| | 3 | 38 | | public IEnumerable<EventListDto> GetAll() => this._fetchService.Fetch(); |
| | | 39 | | |
| | 4 | 40 | | public async Task<EventFormDto?> GetByIdAsync(Guid id) => await this._fetchByIdService.Fetch(id); |
| | | 41 | | } |