Added Service to show character basic properties
This commit is contained in:
parent
e4ce736960
commit
11af142a09
@ -10,6 +10,7 @@ namespace SessionCompanion.Services.Interfaces
|
|||||||
{
|
{
|
||||||
public interface ICharacterService : IServiceBase<CharacterViewModel, Character>
|
public interface ICharacterService : IServiceBase<CharacterViewModel, Character>
|
||||||
{
|
{
|
||||||
|
Task<CharacterBasicStatsViewModel> GetBasicCharacterData(int characterId);
|
||||||
Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId);
|
Task<IEnumerable<CharacterForLoginViewModel>> GetUserLoginCharacters(int userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,5 +37,19 @@ namespace SessionCompanion.Services.Services
|
|||||||
return result;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user