session-companion/SessionCompanion/SessionCompanion.Services/Profiles/CharacterArmorsProfile.cs

35 lines
1.6 KiB
C#
Raw Permalink Normal View History

2020-12-27 19:47:13 +01:00
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Profiles
{
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.CharacterArmorViewModels;
public class CharacterArmorsProfile : Profile
{
public CharacterArmorsProfile()
{
CreateMap<CharacterArmorViewModel, CharacterArmor>().ReverseMap();
CreateMap<CharacterArmor, CharacterArmorViewModelDetails>()
.ForMember(vm => vm.Name, conf => conf.MapFrom(armor => armor.Armor.Name.ToString()))
.ForMember(vm => vm.Category, conf => conf.MapFrom(armor => armor.Armor.Category.ToString()))
.ForMember(
vm => vm.ArmorClassBase,
conf => conf.MapFrom(armor => armor.Armor.ArmorClassBase.ToString()))
.ForMember(vm => vm.HaveDexterityBonus, conf => conf.MapFrom(armor => armor.Armor.HaveDexterityBonus))
.ForMember(vm => vm.MinimumStrength, conf => conf.MapFrom(armor => armor.Armor.MinimumStrength))
.ForMember(
vm => vm.HaveStealthDisadvantage,
conf => conf.MapFrom(armor => armor.Armor.HaveStealthDisadvantage))
.ForMember(vm => vm.Weight, conf => conf.MapFrom(armor => armor.Armor.Weight))
.ForMember(vm => vm.Cost, conf => conf.MapFrom(armor => armor.Armor.Cost))
.ForMember(vm => vm.CurrencyType, conf => conf.MapFrom(armor => armor.Armor.CurrencyType)).ReverseMap();
}
}
}