SES-132 Added Service and Interface for basic character info
This commit is contained in:
parent
c0c8718eb0
commit
527a3f695f
@ -14,5 +14,6 @@ namespace SessionCompanion.Services.Interfaces
|
||||
Task<IEnumerable<CharacterBasicStatsViewModel>> GetBasicCharactersData(List<int> charactersId);
|
||||
Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId);
|
||||
Task<List<UniversalStatisticViewModel>> GetCharacterStatistics(int characterId);
|
||||
Task<CharacterBasicInfoViewModel> GetBasicCharacterbasicInfo(int characterId);
|
||||
}
|
||||
}
|
||||
|
@ -96,5 +96,20 @@ namespace SessionCompanion.Services.Services
|
||||
|
||||
return statistics;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Funkcja zwraca podstawowy widok postaci na podstawie ich id
|
||||
/// </summary>
|
||||
/// <param name="characterId">Lista identyfikatorów postaci</param>
|
||||
/// <returns>Podstawowy widok podanych postaci</returns>
|
||||
public async Task<CharacterBasicInfoViewModel> GetBasicCharacterbasicInfo(int characterId)
|
||||
{
|
||||
var character = await Repository.Get(c => c.Id.Equals(characterId))
|
||||
.Include(x => x.Biography).ThenInclude(x => x.Class)
|
||||
.Include(x => x.Biography).ThenInclude(x => x.Race)
|
||||
.Include(x => x.Statistics).SingleAsync();
|
||||
var result = Mapper.Map<CharacterBasicInfoViewModel>(character);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user