Resolve conflicts

This commit is contained in:
Karol Górzyński 2020-12-06 15:41:18 +01:00
commit 8712191acc
24 changed files with 589 additions and 17 deletions

View File

@ -0,0 +1,20 @@
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.AlignmentViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Services.Profiles
{
class AlignmentProfile : Profile
{
public AlignmentProfile()
{
CreateMap<AlignmentViewModel, Alignment>();
CreateMap<Alignment, AlignmentViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.BackgroundViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Profiles
{
public class BackgroundProfile : Profile
{
public BackgroundProfile()
{
CreateMap<BackgroundViewModel, Background>();
CreateMap<Background, BackgroundViewModel>();
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.BiographyViewModels;
namespace SessionCompanion.Services.Profiles
{
public class BiographyProfile : Profile
{
public BiographyProfile()
{
CreateMap<BiographyViewModel, Biography>();
CreateMap<Biography, BiographyViewModel>()
.ForMember(vm => vm.Languages, conf => conf.MapFrom(bio => bio.Languages.Split(new char[] { ',' }).ToList()));
}
}
}

View File

@ -0,0 +1,201 @@
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));
CreateMap<CharacterForLoginViewModel, Character>();
CreateMap<Character, CharacterStatisticsViewModel>()
// Charisma
.ForMember(vm => vm.CanDeception, conf => conf.MapFrom(charact => charact.Charisma.CanDeception))
.ForMember(vm => vm.CanIntimidation, conf => conf.MapFrom(charact => charact.Charisma.CanIntimidation))
.ForMember(vm => vm.CanPerformance, conf => conf.MapFrom(charact => charact.Charisma.CanPerformance))
.ForMember(vm => vm.CanPersuasion, conf => conf.MapFrom(charact => charact.Charisma.CanPersuasion))
.ForMember(vm => vm.CharismaCanSaveThrows, conf => conf.MapFrom(charact => charact.Charisma.CanSaveThrows))
.ForMember(vm => vm.Deception, conf => conf.MapFrom(charact => charact.Charisma.Deception))
.ForMember(vm => vm.Intimidation, conf => conf.MapFrom(charact => charact.Charisma.Intimidation))
.ForMember(vm => vm.CharismaModification, conf => conf.MapFrom(charact => charact.Charisma.Modification))
.ForMember(vm => vm.Performance, conf => conf.MapFrom(charact => charact.Charisma.Performance))
.ForMember(vm => vm.Persuasion, conf => conf.MapFrom(charact => charact.Charisma.Persuasion))
.ForMember(vm => vm.CharismaSavingThrows, conf => conf.MapFrom(charact => charact.Charisma.SavingThrows))
.ForMember(vm => vm.CharismaValue, conf => conf.MapFrom(charact => charact.Charisma.Value))
// Dexterity
.ForMember(vm => vm.DexterityValue, conf => conf.MapFrom(charact => charact.Dexterity.Value))
.ForMember(vm => vm.DexterityModification, conf => conf.MapFrom(charact => charact.Dexterity.Modification))
.ForMember(vm => vm.DexteritySavingThrows, conf => conf.MapFrom(charact => charact.Dexterity.SavingThrows))
.ForMember(vm => vm.DexterityCanSaveThrows, conf => conf.MapFrom(charact => charact.Dexterity.CanSaveThrows))
.ForMember(vm => vm.CanAcrobatics, conf => conf.MapFrom(charact => charact.Dexterity.CanAcrobatics))
.ForMember(vm => vm.Acrobatics, conf => conf.MapFrom(charact => charact.Dexterity.Acrobatics))
.ForMember(vm => vm.SleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.SleightOfHand))
.ForMember(vm => vm.CanSleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.CanSleightOfHand))
.ForMember(vm => vm.CanStealth, conf => conf.MapFrom(charact => charact.Dexterity.CanStealth))
.ForMember(vm => vm.Stealth, conf => conf.MapFrom(charact => charact.Dexterity.Stealth))
// Strength
.ForMember(vm => vm.Athletics, conf => conf.MapFrom(charact => charact.Strength.Athletics))
.ForMember(vm => vm.CanAthletics, conf => conf.MapFrom(charact => charact.Strength.CanAthletics))
.ForMember(vm => vm.StrengthCanSaveThrows, conf => conf.MapFrom(charact => charact.Strength.CanSaveThrows))
.ForMember(vm => vm.StrengthModification, conf => conf.MapFrom(charact => charact.Strength.Modification))
.ForMember(vm => vm.StrengthSavingThrows, conf => conf.MapFrom(charact => charact.Strength.SavingThrows))
.ForMember(vm => vm.StrengthValue, conf => conf.MapFrom(charact => charact.Strength.Value))
// Wisdom
.ForMember(vm => vm.AnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.AnimalHandling))
.ForMember(vm => vm.CanAnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.CanAnimalHandling))
.ForMember(vm => vm.CanInsight, conf => conf.MapFrom(charact => charact.Wisdom.CanInsight))
.ForMember(vm => vm.CanMedicine, conf => conf.MapFrom(charact => charact.Wisdom.CanMedicine))
.ForMember(vm => vm.CanPerception, conf => conf.MapFrom(charact => charact.Wisdom.CanPerception))
.ForMember(vm => vm.WisdomCanSaveThrows, conf => conf.MapFrom(charact => charact.Wisdom.CanSaveThrows))
.ForMember(vm => vm.CanSurvival, conf => conf.MapFrom(charact => charact.Wisdom.CanSurvival))
.ForMember(vm => vm.Insight, conf => conf.MapFrom(charact => charact.Wisdom.Insight))
.ForMember(vm => vm.Medicine, conf => conf.MapFrom(charact => charact.Wisdom.Medicine))
.ForMember(vm => vm.WisdomModification, conf => conf.MapFrom(charact => charact.Wisdom.Modification))
.ForMember(vm => vm.Perception, conf => conf.MapFrom(charact => charact.Wisdom.Perception))
.ForMember(vm => vm.WisdomSavingThrows, conf => conf.MapFrom(charact => charact.Wisdom.SavingThrows))
.ForMember(vm => vm.Survival, conf => conf.MapFrom(charact => charact.Wisdom.Survival))
.ForMember(vm => vm.WisdomValue, conf => conf.MapFrom(charact => charact.Wisdom.Value))
// Intelligence
.ForMember(vm => vm.Arcana, conf => conf.MapFrom(charact => charact.Intelligence.Arcana))
.ForMember(vm => vm.CanArcana, conf => conf.MapFrom(charact => charact.Intelligence.CanArcana))
.ForMember(vm => vm.CanHistory, conf => conf.MapFrom(charact => charact.Intelligence.CanHistory))
.ForMember(vm => vm.CanInvestigation, conf => conf.MapFrom(charact => charact.Intelligence.CanInvestigation))
.ForMember(vm => vm.CanNature, conf => conf.MapFrom(charact => charact.Intelligence.CanNature))
.ForMember(vm => vm.CanReligion, conf => conf.MapFrom(charact => charact.Intelligence.CanReligion))
.ForMember(vm => vm.IntelligenceCanSaveThrows, conf => conf.MapFrom(charact => charact.Intelligence.CanSaveThrows))
.ForMember(vm => vm.History, conf => conf.MapFrom(charact => charact.Intelligence.History))
.ForMember(vm => vm.Investigation, conf => conf.MapFrom(charact => charact.Intelligence.Investigation))
.ForMember(vm => vm.IntelligenceModification, conf => conf.MapFrom(charact => charact.Intelligence.Modification))
.ForMember(vm => vm.Nature, conf => conf.MapFrom(charact => charact.Intelligence.Nature))
.ForMember(vm => vm.Religion, conf => conf.MapFrom(charact => charact.Intelligence.Religion))
.ForMember(vm => vm.IntelligenceSavingThrows, conf => conf.MapFrom(charact => charact.Intelligence.SavingThrows))
.ForMember(vm => vm.IntelligenceValue, conf => conf.MapFrom(charact => charact.Intelligence.Value))
// Constitution
.ForMember(vm => vm.ConstitutionCanSaveThrows, conf => conf.MapFrom(charact => charact.Constitution.CanSaveThrows))
.ForMember(vm => vm.ConstitutionModification, conf => conf.MapFrom(charact => charact.Constitution.Modification))
.ForMember(vm => vm.ConstitutionSavingThrows, conf => conf.MapFrom(charact => charact.Constitution.SavingThrows))
.ForMember(vm => vm.ConstitutionValue, conf => conf.MapFrom(charact => charact.Constitution.Value));
CreateMap<CharacterStatisticsViewModel, Character>();
CreateMap<Character, CharacterBasicStatsViewModel>()
.ForMember(vm => vm.Id, conf => conf.MapFrom(charact => charact.Id))
.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));
CreateMap<CharacterBasicStatsViewModel, Character>();
CreateMap<CharacterEveryStatViewModel, Character>();
CreateMap<Character, CharacterEveryStatViewModel>()
.ForMember(vm => vm.Name, conf => conf.MapFrom(charac => charac.Biography.Name))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charac => charac.Statistics.Level))
.ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charac => charac.Statistics.CurrentHealthPoints))
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charac => charac.Biography.Class.Name))
.ForMember(vm => vm.Name, conf => conf.MapFrom(charac => charac.Biography.Name))
.ForMember(vm => vm.CanDeception, conf => conf.MapFrom(charact => charact.Charisma.CanDeception))
.ForMember(vm => vm.CanIntimidation, conf => conf.MapFrom(charact => charact.Charisma.CanIntimidation))
.ForMember(vm => vm.CanPerformance, conf => conf.MapFrom(charact => charact.Charisma.CanPerformance))
.ForMember(vm => vm.CanPersuasion, conf => conf.MapFrom(charact => charact.Charisma.CanPersuasion))
.ForMember(vm => vm.CharismaCanSaveThrows, conf => conf.MapFrom(charact => charact.Charisma.CanSaveThrows))
.ForMember(vm => vm.Deception, conf => conf.MapFrom(charact => charact.Charisma.Deception))
.ForMember(vm => vm.Intimidation, conf => conf.MapFrom(charact => charact.Charisma.Intimidation))
.ForMember(vm => vm.CharismaModification, conf => conf.MapFrom(charact => charact.Charisma.Modification))
.ForMember(vm => vm.Performance, conf => conf.MapFrom(charact => charact.Charisma.Performance))
.ForMember(vm => vm.Persuasion, conf => conf.MapFrom(charact => charact.Charisma.Persuasion))
.ForMember(vm => vm.CharismaSavingThrows, conf => conf.MapFrom(charact => charact.Charisma.SavingThrows))
.ForMember(vm => vm.CharismaValue, conf => conf.MapFrom(charact => charact.Charisma.Value))
// Dexterity
.ForMember(vm => vm.DexterityValue, conf => conf.MapFrom(charact => charact.Dexterity.Value))
.ForMember(vm => vm.DexterityModification, conf => conf.MapFrom(charact => charact.Dexterity.Modification))
.ForMember(vm => vm.DexteritySavingThrows, conf => conf.MapFrom(charact => charact.Dexterity.SavingThrows))
.ForMember(vm => vm.DexterityCanSaveThrows, conf => conf.MapFrom(charact => charact.Dexterity.CanSaveThrows))
.ForMember(vm => vm.CanAcrobatics, conf => conf.MapFrom(charact => charact.Dexterity.CanAcrobatics))
.ForMember(vm => vm.Acrobatics, conf => conf.MapFrom(charact => charact.Dexterity.Acrobatics))
.ForMember(vm => vm.SleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.SleightOfHand))
.ForMember(vm => vm.CanSleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.CanSleightOfHand))
.ForMember(vm => vm.CanStealth, conf => conf.MapFrom(charact => charact.Dexterity.CanStealth))
.ForMember(vm => vm.Stealth, conf => conf.MapFrom(charact => charact.Dexterity.Stealth))
// Strength
.ForMember(vm => vm.Athletics, conf => conf.MapFrom(charact => charact.Strength.Athletics))
.ForMember(vm => vm.CanAthletics, conf => conf.MapFrom(charact => charact.Strength.CanAthletics))
.ForMember(vm => vm.StrengthCanSaveThrows, conf => conf.MapFrom(charact => charact.Strength.CanSaveThrows))
.ForMember(vm => vm.StrengthModification, conf => conf.MapFrom(charact => charact.Strength.Modification))
.ForMember(vm => vm.StrengthSavingThrows, conf => conf.MapFrom(charact => charact.Strength.SavingThrows))
.ForMember(vm => vm.StrengthValue, conf => conf.MapFrom(charact => charact.Strength.Value))
// Wisdom
.ForMember(vm => vm.AnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.AnimalHandling))
.ForMember(vm => vm.CanAnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.CanAnimalHandling))
.ForMember(vm => vm.CanInsight, conf => conf.MapFrom(charact => charact.Wisdom.CanInsight))
.ForMember(vm => vm.CanMedicine, conf => conf.MapFrom(charact => charact.Wisdom.CanMedicine))
.ForMember(vm => vm.CanPerception, conf => conf.MapFrom(charact => charact.Wisdom.CanPerception))
.ForMember(vm => vm.WisdomCanSaveThrows, conf => conf.MapFrom(charact => charact.Wisdom.CanSaveThrows))
.ForMember(vm => vm.CanSurvival, conf => conf.MapFrom(charact => charact.Wisdom.CanSurvival))
.ForMember(vm => vm.Insight, conf => conf.MapFrom(charact => charact.Wisdom.Insight))
.ForMember(vm => vm.Medicine, conf => conf.MapFrom(charact => charact.Wisdom.Medicine))
.ForMember(vm => vm.WisdomModification, conf => conf.MapFrom(charact => charact.Wisdom.Modification))
.ForMember(vm => vm.Perception, conf => conf.MapFrom(charact => charact.Wisdom.Perception))
.ForMember(vm => vm.WisdomSavingThrows, conf => conf.MapFrom(charact => charact.Wisdom.SavingThrows))
.ForMember(vm => vm.Survival, conf => conf.MapFrom(charact => charact.Wisdom.Survival))
.ForMember(vm => vm.WisdomValue, conf => conf.MapFrom(charact => charact.Wisdom.Value))
// Intelligence
.ForMember(vm => vm.Arcana, conf => conf.MapFrom(charact => charact.Intelligence.Arcana))
.ForMember(vm => vm.CanArcana, conf => conf.MapFrom(charact => charact.Intelligence.CanArcana))
.ForMember(vm => vm.CanHistory, conf => conf.MapFrom(charact => charact.Intelligence.CanHistory))
.ForMember(vm => vm.CanInvestigation, conf => conf.MapFrom(charact => charact.Intelligence.CanInvestigation))
.ForMember(vm => vm.CanNature, conf => conf.MapFrom(charact => charact.Intelligence.CanNature))
.ForMember(vm => vm.CanReligion, conf => conf.MapFrom(charact => charact.Intelligence.CanReligion))
.ForMember(vm => vm.IntelligenceCanSaveThrows, conf => conf.MapFrom(charact => charact.Intelligence.CanSaveThrows))
.ForMember(vm => vm.History, conf => conf.MapFrom(charact => charact.Intelligence.History))
.ForMember(vm => vm.Investigation, conf => conf.MapFrom(charact => charact.Intelligence.Investigation))
.ForMember(vm => vm.IntelligenceModification, conf => conf.MapFrom(charact => charact.Intelligence.Modification))
.ForMember(vm => vm.Nature, conf => conf.MapFrom(charact => charact.Intelligence.Nature))
.ForMember(vm => vm.Religion, conf => conf.MapFrom(charact => charact.Intelligence.Religion))
.ForMember(vm => vm.IntelligenceSavingThrows, conf => conf.MapFrom(charact => charact.Intelligence.SavingThrows))
.ForMember(vm => vm.IntelligenceValue, conf => conf.MapFrom(charact => charact.Intelligence.Value))
// Constitution
.ForMember(vm => vm.ConstitutionCanSaveThrows, conf => conf.MapFrom(charact => charact.Constitution.CanSaveThrows))
.ForMember(vm => vm.ConstitutionModification, conf => conf.MapFrom(charact => charact.Constitution.Modification))
.ForMember(vm => vm.ConstitutionSavingThrows, conf => conf.MapFrom(charact => charact.Constitution.SavingThrows))
.ForMember(vm => vm.ConstitutionValue, conf => conf.MapFrom(charact => charact.Constitution.Value));
CreateMap<CharacterBioViewModel, Character>();
CreateMap<Character, CharacterBioViewModel>()
.ForMember(vm => vm.CharacterId, conf => conf.MapFrom(charact => charact.Id))
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
.ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex))
.ForMember(vm => vm.CharacterLanguages, conf => conf.MapFrom(charact => charact.Biography.Languages.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.ClassId, conf => conf.MapFrom(charact => charact.Biography.Class.Id))
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name))
.ForMember(vm => vm.Proficiencies, conf => conf.MapFrom(charact => charact.Biography.Class.Proficiencies.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.Subclasses, conf => conf.MapFrom(charact => charact.Biography.Class.Subclasses))
.ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex))
.ForMember(vm => vm.RaceName, conf => conf.MapFrom(charact => charact.Biography.Race.Name))
.ForMember(vm => vm.RaceLanguages, conf => conf.MapFrom(charact => charact.Biography.Race.Language.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex))
.ForMember(vm => vm.LanguageDescription, conf => conf.MapFrom(charact => charact.Biography.Race.LanguageDescription))
.ForMember(vm => vm.SizeDescription, conf => conf.MapFrom(charact => charact.Biography.Race.SizeDescription))
.ForMember(vm => vm.StartingProficiencies, conf => conf.MapFrom(charact => charact.Biography.Race.StartingProficiencies.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.Traits, conf => conf.MapFrom(charact => charact.Biography.Race.Traits.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.ExperiencePoints, conf => conf.MapFrom(charact => charact.Statistics.ExperiencePoints))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
.ForMember(vm => vm.Speed, conf => conf.MapFrom(charact => charact.Statistics.Speed))
.ForMember(vm => vm.Initiative, conf => conf.MapFrom(charact => charact.Statistics.Initiative));
//.ForMember(vm => vm.Features, conf => conf.MapFrom(charact => charact.Biography.Class.ClassFeatures.Where(x => x.ClassId.Equals(charact.Biography.ClassId)).Select(f => f.Feature)));
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.CharismaViewModels;
namespace SessionCompanion.Services.Profiles
{
public class CharismaProfile : Profile
{
public CharismaProfile()
{
CreateMap<CharismaViewModel, Charisma>();
CreateMap<Charisma, CharismaViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.ClassViewModels;
namespace SessionCompanion.Services.Profiles
{
public class ClassProfile : Profile
{
public ClassProfile()
{
CreateMap<ClassViewModel, Class>();
CreateMap<Class, ClassViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.ConstitutionViewModels;
namespace SessionCompanion.Services.Profiles
{
public class ConstitutionProfile : Profile
{
public ConstitutionProfile()
{
CreateMap<ConstitutionViewModel, Constitution>();
CreateMap<Constitution,ConstitutionViewModel > ();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.DexterityViewModels;
namespace SessionCompanion.Services.Profiles
{
public class DexterityProfile : Profile
{
public DexterityProfile()
{
CreateMap<DexterityViewModel, Dexterity>();
CreateMap<Dexterity, DexterityViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.IntelligenceViewModels;
namespace SessionCompanion.Services.Profiles
{
public class IntelligenceProfile : Profile
{
public IntelligenceProfile()
{
CreateMap<IntelligenceViewModel, Intelligence>();
CreateMap<Intelligence, IntelligenceViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.RaceViewModels;
namespace SessionCompanion.Services.Profiles
{
public class RaceProfile : Profile
{
public RaceProfile()
{
CreateMap<Race, RaceViewModel>();
CreateMap<RaceViewModel, Race>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.StatisticsViewModels;
namespace SessionCompanion.Services.Profiles
{
public class StatisticsProfile : Profile
{
public StatisticsProfile()
{
CreateMap<StatisticsViewModel, Statistics>();
CreateMap<Statistics, StatisticsViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.StrengthViewModels;
namespace SessionCompanion.Services.Profiles
{
public class StrengthProfile : Profile
{
public StrengthProfile()
{
CreateMap<StrengthViewModel, Strength>();
CreateMap<Strength, StrengthViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.UserViewModels;
namespace SessionCompanion.Services.Profiles
{
public class UserProfile : Profile
{
public UserProfile()
{
CreateMap<UserViewModel, User>();
CreateMap<User, UserViewModel>();
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using SessionCompanion.Database.Tables;
using SessionCompanion.ViewModels.WisdomViewModels;
namespace SessionCompanion.Services.Profiles
{
public class WisdomProfile : Profile
{
public WisdomProfile()
{
CreateMap<WisdomViewModel, Wisdom>();
CreateMap<Wisdom, WisdomViewModel>();
}
}
}

View File

@ -1,14 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.ViewModels.CharacterViewModels
namespace SessionCompanion.ViewModels.CharacterViewModels
{
public class CharacterBasicStatsViewModel
{
/// <summary>
/// Identyfikator psotaci
/// </summary>
public int Id { get; set; }
/// <summary>
/// Nazwa postaci
/// </summary>
public string Name { get; set; }
/// <summary>
/// Poziom postaci
/// </summary>
public int Level { get; set; }
/// <summary>
/// Aktualna ilość życia postaci
/// </summary>
public int CurrentHealthPoints { get; set; }
}
}

View File

@ -1,16 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace SessionCompanion.ViewModels.CharacterViewModels
namespace SessionCompanion.ViewModels.CharacterViewModels
{
public class CharacterForLoginViewModel
{
/// <summary>
/// Identyfikator psotaci
/// </summary>
public int Id { get; set; }
/// <summary>
/// Id użytkownika do którego przypisana jest postać
/// </summary>
public int UserId { get; set; }
/// <summary>
/// Nazwa postaci
/// </summary>
public string Name { get; set; }
/// <summary>
/// Nazwa klasy postaci
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// Poziom postaci
/// </summary>
public int Level { get; set; }
}
}

View File

@ -1,13 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace SessionCompanion.ViewModels.CharacterViewModels
namespace SessionCompanion.ViewModels.CharacterViewModels
{
public class CharacterViewModel
{
/// <summary>
/// Identyfikator psotaci
/// </summary>
public int Id { get; set; }
/// <summary>
/// Id użytkownika do którego przypisana jest postać
/// </summary>
public int UserId { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces;
namespace SessionCompanion.Controllers
{
[Route("api/background")]
[ApiController]
public class BackgroundController : Controller
{
private readonly IBackgroundService _service;
public BackgroundController(IBackgroundService service)
{
_service = service;
}
}
}

View File

@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces;
namespace SessionCompanion.Controllers
{
[Route("api/biography")]
[ApiController]
public class BiographyController : Controller
{
private readonly IBiographyService _service;
public BiographyController(IBiographyService service)
{
_service = service;
}
}
}

View File

@ -0,0 +1,33 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces;
namespace SessionCompanion.Controllers
{
using SessionCompanion.ViewModels.CharacterViewModels;
[Route("api/character")]
[ApiController]
public class CharacterController : Controller
{
private readonly ICharacterService _service;
public CharacterController(ICharacterService service)
{
this._service = service;
}
/// <summary>
/// Metoda zwraca postać ze wskazanym identyfikatorem
/// </summary>
/// <param name="id">Identyfikator postaci</param>
/// <returns>ViewModel Postaci</returns>
[HttpGet("{id}")]
public async Task<CharacterViewModel> Get(int id)
{
return await _service.Get(id);
}
}
}

View File

@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces;
namespace SessionCompanion.Controllers
{
[Route("api/statistic")]
[ApiController]
public class StatisticController : Controller
{
private readonly IStatisticsService _service;
public StatisticController(IStatisticsService service)
{
this._service = service;
}
}
}

View File

@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Mvc;
using SessionCompanion.Services.Interfaces;
namespace SessionCompanion.Controllers
{
[Route("api/user")]
[ApiController]
public class UserController : Controller
{
private readonly IUserService _service;
public UserController(IUserService service)
{
this._service = service;
}
}
}

View File

@ -13,6 +13,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">

View File

@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using AutoMapper;
using SessionCompanion.Configurations;
using SessionCompanion.Database;
using SessionCompanion.Hubs;
@ -32,6 +33,7 @@ namespace SessionCompanion
Configuration.GetConnectionString("DefaultConnection")));
services.AddRepositories();
services.AddServices();
services.AddAutoMapper(typeof(Startup));
services.AddSignalR();
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>