using Serwer.Core.Domain; using Serwer.Core.Repositories; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Serwer.Infrastructure.Services { public class HistoryService: IHistoryService { private readonly IHistoryRepository _historyRepository; private readonly IUserRepository _userRepository; public HistoryService(IHistoryRepository historyRepository, IUserRepository userRepository) { _historyRepository = historyRepository; _userRepository = userRepository; } public async Task GetAsync(Guid userId) { var user = await _userRepository.GetAsync(userId); if(user == null) { throw new Exception("Coś poszło nie tak."); } var history = await _historyRepository.GetAsync(user); return history; } } }