public static CharacterProficiency Convert(Database.DatabaseModels.CharacterProficiency dbCharacterProficiency) { CharacterProficiency charProf = new CharacterProficiency(); charProf.charId = dbCharacterProficiency.charId; charProf.proficiencyId = dbCharacterProficiency.proficiencyId; charProf.proficiencyLevel = dbCharacterProficiency.proficiencyLevel; charProf.passiveValue = dbCharacterProficiency.passiveValue; return(charProf); }
public override bool Load(int id) { Database.DatabaseModels.Character character = new Database.DatabaseModels.Character(); bool charLoad = character.Load(id); this.id = character.id; name = character.name; currentHealth = character.currentHealth; maxHealth = character.maxHealth; currentXP = character.currentXP; background = character.background; gender = character.gender; proficiencies = CharacterProficiency.LoadByCharacterId(id); races = CharacterRace.LoadByCharacterId(id); return(charLoad); }
public static List <CharacterProficiency> LoadByCharacterId(int charId) { List <Database.DatabaseModels.CharacterProficiency> list = Database.DatabaseModels.CharacterProficiency.LoadByCharacterId(charId); List <CharacterProficiency> characterProficiencies = new List <CharacterProficiency>(); foreach (Database.DatabaseModels.CharacterProficiency characterProficiency in list) { // Convert DB model to Model CharacterProficiency newProf = Convert(characterProficiency); // Get Proficiency data and add it to Model newProf.Load(characterProficiency.proficiencyId); characterProficiencies.Add(newProf); } return(characterProficiencies); }