Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            if(id == null)
            {
                return RedirectToAction("Index");
            }

            var eWarZone = db.WarZones.Find(id);

            if(eWarZone == null)
            {
                return RedirectToAction("Error", "Home");
            }

            var vm = new WarZoneDetailsViewModel
            {
                WarZoneId = eWarZone.WarZoneId,
                Name = eWarZone.Name,
                AllianceForce = eWarZone.AllianceForce,
                HordeForce = eWarZone.HordeForce,
                Continent = eWarZone.Continent
            };

            return View(vm);
        }
Exemplo n.º 2
0
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return RedirectToAction("Index");
            }

            var warzone = db.WarZones.Find(id);

            if (warzone == null)
            {
                return RedirectToAction("Error", "Home");
            }

            var vm = new WarZoneDetailsViewModel
            {
                Name = warzone.Name,
                AllianceForce = warzone.AllianceForce,
                HordeForce = warzone.HordeForce,
                UpdatedDate = warzone.UpdatedDate,
                AlliancePercent = warzone.Influence >= 0 ? ((warzone.Influence / warzone.Limit) * 100) + 50 : 50 - ((warzone.Influence / warzone.Limit) * 100),
                Influence = warzone.Influence,
                Limit = warzone.Limit,
                Battles = warzone.Battles.ToList()
            };

            return View(vm);
        }