public CharacterViewModel(int characterId, AppSetting appSetting) { DataObj dbo = new DataObj(appSetting); Character character = dbo.pullCharInfoById(characterId); id = character.id; name = character.name; level = character.level.ToString(); gender = character.gender; alignment = character.alignment; race = character.race; charClass = character.charClass; str = character.str.ToString(); con = character.con.ToString(); dex = character.dex.ToString(); inte = character.inte.ToString(); cha = character.cha.ToString(); wis = character.wis.ToString(); armor = character.armor; hitpoints = character.hitpoints; speed = character.speed; spells = character.spells; weapons = character.weapons; raceList = new SelectList(dbo.getAllRaces(), "id", "name", race); classList = new SelectList(dbo.getAllClasses(), "id", "name"); alignmentList = new SelectList(dbo.getAllAlignments(), "id", "name"); weaponList = new SelectList(dbo.getAllWeapons(), "id", "name"); spellList = new SelectList(dbo.getAllSpells(), "id", "name"); }
public Character(int id, AppSetting appSetting) { DataObj data = new DataObj(appSetting); Character temp = data.pullCharInfoById(id); this.name = temp.name; this.id = id; this.str = temp.str; this.dex = temp.dex; this.con = temp.con; this.inte = temp.inte; this.wis = temp.wis; this.cha = temp.cha; this.race = temp.race; this.gender = temp.gender; this.level = temp.level; this.armor = temp.armor; this.speed = temp.speed; this.hitpoints = temp.hitpoints; this.charClass = temp.charClass; this.alignment = temp.alignment; this.spells = temp.spells; this.weapons = temp.weapons; }