33 lines
983 B
C#
33 lines
983 B
C#
|
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<UserHistory> 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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|