SES-132 Added Service and Interface for basic character info

This commit is contained in:
Karol Górzyński 2021-01-07 17:39:01 +01:00
parent c0c8718eb0
commit 527a3f695f
2 changed files with 16 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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;
}
}
}