Added Service to show character basic properties

This commit is contained in:
Karol Górzyński 2020-12-20 15:45:29 +01:00
parent e4ce736960
commit 11af142a09
2 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,7 @@ namespace SessionCompanion.Services.Interfaces
{
public interface ICharacterService : IServiceBase<CharacterViewModel, Character>
{
Task<CharacterBasicStatsViewModel> GetBasicCharacterData(int characterId);
Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId);
}
}

View File

@ -37,5 +37,19 @@ namespace SessionCompanion.Services.Services
return result;
}
/// <summary>
/// Funkcja zwraca podstawowy widok postaci na podstawie ich id
/// </summary>
/// <param name="characterId">identyfikator postaci</param>
/// <returns>Podstawowy widok danej postaci</returns>
public async Task<CharacterBasicStatsViewModel> GetBasicCharacterData(int characterId)
{
var characters = await Repository.Get(c => c.Id == characterId)
.Include(x => x.Biography)
.Include(x => x.Statistics).ToListAsync();
var result = Mapper.Map<CharacterBasicStatsViewModel>(characters);
return result;
}
}
}