2020-12-27 19:47:13 +01:00
|
|
|
|
namespace SessionCompanion.Services.Services
|
|
|
|
|
{
|
2021-01-12 12:46:50 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-12-27 19:47:13 +01:00
|
|
|
|
|
|
|
|
|
using AutoMapper;
|
2021-01-12 12:46:50 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2020-12-27 19:47:13 +01:00
|
|
|
|
using SessionCompanion.Database.Repositories.Base;
|
|
|
|
|
using SessionCompanion.Database.Tables;
|
|
|
|
|
using SessionCompanion.Services.Base;
|
|
|
|
|
using SessionCompanion.Services.Interfaces;
|
|
|
|
|
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
|
|
|
|
|
|
|
|
|
|
public class CharacterOtherEquipmentService : ServiceBase<CharacterOtherEquipmentViewModel, CharacterOtherEquipment>, ICharacterOtherEquipmentService
|
|
|
|
|
{
|
|
|
|
|
public CharacterOtherEquipmentService(IMapper mapper, IRepository<CharacterOtherEquipment> repository) : base(mapper, repository)
|
|
|
|
|
{ }
|
|
|
|
|
|
2021-01-12 12:46:50 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Metoda pobiera listę pozostałego ekwipunku konkretnej postaci
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="characterId"> Id postaci </param>
|
|
|
|
|
/// <returns> Lista pozostałego ekwpinuku posiadanego przez postać </returns>
|
|
|
|
|
public async Task<List<CharacterOtherEquipmentWithDetailsViewModel>> GetCharacterOtherEquipmentList(int characterId)
|
|
|
|
|
{
|
|
|
|
|
var characterWeapons = await Repository.Get().Where(a => a.CharacterId.Equals(characterId)).Include(a => a.OtherEquipment).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var result = Mapper.Map<List<CharacterOtherEquipmentWithDetailsViewModel>>(characterWeapons);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2020-12-27 19:47:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|