Пример #1
0
        public WarViewModel(Entities.War war, IWarService warService, IWarRepository warRepository)
        {
            Info = new WarInfoViewModel(war, warRepository, warService);

            foreach (var battle in war.Battles.OrderByDescending(b => b.Active).ThenByDescending(b => b.ID).ToList())
            {
                ActiveBattles.Add(new SummaryBattleViewModel(battle));
            }
        }
Пример #2
0
        public StartBattleViewModel(Entities.War war, IWarRepository warRepository, IWarService warSerivce)
        {
            Info = new WarInfoViewModel(war, warRepository, warSerivce);

            var warSide = warSerivce.GetWarSide(war, SessionHelper.CurrentEntity);

            ConquerableRegions.Add(new SelectListItem()
            {
                Value = "null",
                Text  = "-- Select region --"
            });

            ConquerableRegions.AddRange(warRepository.GetAttackableRegions(war.ID, warSide == WarSideEnum.Attacker)
                                        .Select(r => new { Name = r.Name, ID = r.ID })
                                        .ToList()
                                        .Select(r => new SelectListItem()
            {
                Value = r.ID.ToString(), Text = r.Name
            })
                                        .ToList());
        }