30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
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))
|
|
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
|
|
|
|
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))
|
|
.ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)).ReverseMap();
|
|
}
|
|
}
|
|
}
|