Пример #1
0
        public WeaponResource GetWeaponByID(int ID)
        {
            var weapon = _weaponRepository.GetById(ID);

            if (weapon == null)
            {
                throw new WeaponNotFoundException("Weapon matching ID not found.");
            }

            var result = _mapper.Map <WeaponResource>(weapon);

            return(result);
        }
Пример #2
0
        public void UpdateWeapon()
        {
            WeaponRepository repo = new WeaponRepository(new WeaponSQLContext());
            Weapon           c    = repo.GetById(4);

            c.PhysDamage += 20;
            int damage = c.PhysDamage;

            repo.Update(c);
            c = repo.GetById(4);
            Assert.AreEqual(c.PhysDamage, damage, "Weapon wasn't updated.");
            c.PhysDamage -= 20;
            repo.Update(c);
        }
Пример #3
0
        public void WeaponSelect()
        {
            WeaponRepository repo = new WeaponRepository(new WeaponSQLContext());
            Weapon           c    = repo.GetById(4);

            Assert.IsNotNull(c, "Weapon wasn't correctly retrieved");
        }
Пример #4
0
        public ActionResult Delete(int id)
        {
            weaponRepository = new WeaponRepository();
            var weapon = weaponRepository.GetById(id);

            return(View(weapon));
        }