Beispiel #1
0
 internal static BaseStatDTO GenerateBaseStatDTOFromModel(BaseStatModel baseStat)
 {
     return(new BaseStatDTO()
     {
         ID = baseStat.ID,
         Name = baseStat.Name,
         Value = baseStat.Value
     });
 }
Beispiel #2
0
 internal static CharacterDTO GenerateCharacterDTOFromModel(CharacterModel character)
 {
     return(new CharacterDTO()
     {
         ID = character.ID,
         Name = character.Name,
         Description = character.Description,
         Level = character.Level,
         Race = new RaceDTO()
         {
             ID = character.RaceID
         },
         Class = new ClassDTO()
         {
             ID = character.ClassID
         },
         BaseStats = character.BaseStats.Select(e => BaseStatModel.GenerateBaseStatDTOFromModel(e))
     });
 }
Beispiel #3
0
 /// <summary>
 /// Generates the character model from the dto.
 /// </summary>
 /// <param name="character">The character.</param>
 /// <returns></returns>
 internal static CharacterModel GenerateCharacterModelFromDTO(CharacterDTO character)
 {
     return(new CharacterModel()
     {
         ID = character.ID,
         Description = character.Description,
         Name = character.Name,
         LastEdited = character.LastEdited,
         Level = character.Level,
         Class = character.Class != null?ClassModel.GenerateClassModelFromDTO(character.Class) : null,
                     Race = character.Race != null?RaceModel.GenerateRaceModelFromDTO(character.Race) : null,
                                BaseStats = character.BaseStats != null?character.BaseStats.Select(e => BaseStatModel.GeneralBaseStatModelFromDTO(e)) : null,
                                                ClassID = character.Class != null ? character.Class.ID : 0,
                                                RaceID = character.Race != null ? character.Race.ID : 0,
                                                GameID = character.GameID
     });
 }