Beispiel #1
0
        public IActionResult Details(Guid id)
        {
            var user   = _userManager.GetByEmail(User.Identity.Name);
            var player = _playerManager.Get(new Guid(user.Id));
            var c      = _classManager.Get(player.ClassId.Value);

            if (c.Name == "Warrior")
            {
                var weapon         = ServicesAutoMapperConfig.Mapped.Map <WeaponType>(_weaponTypeManager.Get(id));
                var shield         = ServicesAutoMapperConfig.Mapped.Map <WeaponType>(_weaponTypeManager.GetShield());
                var warriorWeapons = new List <WeaponType> {
                    weapon, shield
                };

                var viewModel = new WeaponViewModel
                {
                    WeaponTypes = warriorWeapons
                };

                return(View(viewModel));
            }
            else
            {
                var weapon  = ServicesAutoMapperConfig.Mapped.Map <WeaponType>(_weaponTypeManager.Get(id));
                var weapons = new List <WeaponType> {
                    weapon
                };

                var viewModel = new WeaponViewModel
                {
                    WeaponTypes = weapons
                };
                return(View(viewModel));
            }
        }