33 lines
2.2 KiB
C#
33 lines
2.2 KiB
C#
using AutoMapper;
|
|
using SessionCompanion.Database.Tables;
|
|
using SessionCompanion.ViewModels.CharacterWeaponViewModels;
|
|
|
|
namespace SessionCompanion.Services.Profiles
|
|
{
|
|
public class CharacterWeaponsProfile : Profile
|
|
{
|
|
public CharacterWeaponsProfile()
|
|
{
|
|
CreateMap<CharacterWeaponViewModel, CharacterWeapon>().ReverseMap();
|
|
|
|
CreateMap<CharacterWeapon, CharacterWeaponWithWeaponDetailsViewModel>()
|
|
.ForMember(vm => vm.Name, conf => conf.MapFrom(weapon => weapon.Weapon.Name.ToString()))
|
|
.ForMember(vm => vm.Weight, conf => conf.MapFrom(weapon => weapon.Weapon.Weight.ToString()))
|
|
.ForMember(vm => vm.HoldInRightHand, conf => conf.MapFrom(weapon => weapon.HoldInRightHand))
|
|
.ForMember(vm => vm.HoldInLeftHand, conf => conf.MapFrom(weapon => weapon.HoldInLeftHand))
|
|
.ForMember(vm => vm.Cost, conf => conf.MapFrom(weapon => weapon.Weapon.Cost.ToString()))
|
|
.ForMember(vm => vm.RangeMeele, conf => conf.MapFrom(weapon => weapon.Weapon.RangeMeele))
|
|
.ForMember(vm => vm.RangeLong, conf => conf.MapFrom(weapon => weapon.Weapon.RangeLong))
|
|
.ForMember(vm => vm.RangeThrowNormal, conf => conf.MapFrom(weapon => weapon.Weapon.RangeThrowNormal))
|
|
.ForMember(vm => vm.RangeThrowLong, conf => conf.MapFrom(weapon => weapon.Weapon.RangeThrowLong))
|
|
.ForMember(vm => vm.CurrencyType, conf => conf.MapFrom(weapon => weapon.Weapon.CurrencyType.ToString()))
|
|
.ForMember(vm => vm.WeaponType, conf => conf.MapFrom(weapon => weapon.Weapon.WeaponType.ToString()))
|
|
.ForMember(vm => vm.Description, conf => conf.MapFrom(weapon => weapon.Weapon.Description))
|
|
.ForMember(vm => vm.DiceValue, conf => conf.MapFrom(weapon => weapon.Weapon.DiceValue))
|
|
.ForMember(vm => vm.DiceCount, conf => conf.MapFrom(weapon => weapon.Weapon.DiceCount))
|
|
.ForMember(vm => vm.TwoHandDiceValue, conf => conf.MapFrom(weapon => weapon.Weapon.TwoHandDiceValue))
|
|
.ForMember(vm => vm.TwoHandDamageType, conf => conf.MapFrom(weapon => weapon.Weapon.TwoHandDamageType.ToString())).ReverseMap();
|
|
}
|
|
}
|
|
}
|