public void OnGetDetails(int id, int toggle) { Creature = new GetCreature(_ctx).Get(id); LastToggle = toggle; Creatures = new GetCreatures(_ctx).Get(); Weapons = new GetWeapons(_ctx).Get(); Armors = new GetArmors(_ctx).Get(); Items = new GetItems(_ctx).Get(); Spells = new GetSpells(_ctx).Get(); }
} // after the battle should be set to false public static bool AssignHero(int heroId, ApplicationDbContext ctx) { Hero = new GetCreature(ctx).Get(heroId); if (Hero == null) { return(false); } return(true); }
public static bool AddEnemy(int enemyId, ApplicationDbContext ctx) { Creature enemy = new GetCreature(ctx).Get(enemyId); if (enemy == null) { return(false); } if (Enemies == null) { Enemies = new List <Creature>(); } var deserializeSettings = new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }; enemy = JsonConvert.DeserializeObject <Creature>(JsonConvert.SerializeObject(enemy), deserializeSettings); Enemies.Add(enemy); return(true); }