SES-132 Endpoint podstawowych informacji #56

Merged
s426134 merged 3 commits from SES-132 into dev 2021-01-08 14:24:42 +01:00
2 changed files with 16 additions and 0 deletions
Showing only changes of commit 527a3f695f - Show all commits

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