|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
using API.Dto;
|
|
|
|
|
using Model;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Reflection.PortableExecutable;
|
|
|
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
|
using System.Security.Claims;
|
|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
|
|
|
|
|
namespace API.Mapping
|
|
|
|
|
{
|
|
|
|
@ -26,8 +24,8 @@ namespace API.Mapping
|
|
|
|
|
ValueCharac = champion.Characteristics.Values,
|
|
|
|
|
|
|
|
|
|
Class = champion.Class,
|
|
|
|
|
Skins = champion.Skins,
|
|
|
|
|
Skills = champion.Skills,
|
|
|
|
|
Skins = (ReadOnlyCollection<SkinDto>)champion.Skins.Select(skin => skin.ToDto()),
|
|
|
|
|
Skills = (ImmutableHashSet<SkillDto>)champion.Skills.Select(skill => skill.ToDto()),
|
|
|
|
|
Image = champion.Image
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -38,8 +36,11 @@ namespace API.Mapping
|
|
|
|
|
throw new ArgumentNullException("DtoChampion null");
|
|
|
|
|
}
|
|
|
|
|
var champion = new Champion(DtoChamp.Name, DtoChamp.Class, DtoChamp.Icon, DtoChamp.Image.Base64, DtoChamp.Bio);
|
|
|
|
|
|
|
|
|
|
if (DtoChamp.Skills != null) foreach (var skill in DtoChamp.Skills) { champion.AddSkill(skill.toModel()); }
|
|
|
|
|
if (DtoChamp.Characteristics != null) foreach (var charac in DtoChamp.Characteristics) { champion.AddCharacteristics(charac.toModel()); }
|
|
|
|
|
|
|
|
|
|
champion.AddCharacteristics((Tuple<string, int>)DtoChamp.NameCharac.Zip(DtoChamp.ValueCharac, (name, value) => Tuple.Create(name, value)));
|
|
|
|
|
|
|
|
|
|
return champion;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|