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

30 lines
1.3 KiB
C#
Raw Normal View History

2020-12-06 11:21:33 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.CharacterViewModels;
namespace SessionCompanion.Services.Profiles
{
public class CharacterProfile : Profile
{
public CharacterProfile()
{
CreateMap<Character, CharacterViewModel>();
CreateMap<CharacterViewModel, Character>();
CreateMap<Character, CharacterForLoginViewModel>()
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
2020-12-06 16:28:16 +01:00
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
2020-12-06 11:21:33 +01:00
CreateMap<Character, CharacterBasicStatsViewModel>()
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
2020-12-06 16:28:16 +01:00
.ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)).ReverseMap();
2020-12-06 11:21:33 +01:00
}
}
}