2020-12-27 19:47:13 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace SessionCompanion.Services.Services
|
|
|
|
|
{
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
using AutoMapper;
|
|
|
|
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
using SessionCompanion.Database.Repositories.Base;
|
|
|
|
|
using SessionCompanion.Database.Tables;
|
|
|
|
|
using SessionCompanion.Services.Base;
|
|
|
|
|
using SessionCompanion.Services.Interfaces;
|
|
|
|
|
using SessionCompanion.ViewModels.CharacterArmorViewModels;
|
2021-01-12 12:46:50 +01:00
|
|
|
|
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
|
2020-12-27 19:47:13 +01:00
|
|
|
|
|
|
|
|
|
public class CharacterArmorService : ServiceBase<CharacterArmorViewModel, CharacterArmor>, ICharacterArmorService
|
|
|
|
|
{
|
|
|
|
|
public CharacterArmorService(IMapper mapper, IRepository<CharacterArmor> repository) : base(mapper, repository)
|
|
|
|
|
{ }
|
2021-01-12 12:46:50 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Metoda pobiera listę pancerzy konkretnej postaci
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="characterId"> Id postaci </param>
|
|
|
|
|
/// <returns> Lista pancerzy posiadanych przez postać </returns>
|
|
|
|
|
public async Task<List<CharacterArmorViewModelDetails>> GetCharacterArmorsTaskList(int characterId)
|
|
|
|
|
{
|
|
|
|
|
var characterWeapons = await Repository.Get().Where(a => a.CharacterId.Equals(characterId)).Include(a => a.Armor).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var result = Mapper.Map<List<CharacterArmorViewModelDetails>>(characterWeapons);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2020-12-27 19:47:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|