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); }
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); }
public void WeaponSelect() { WeaponRepository repo = new WeaponRepository(new WeaponSQLContext()); Weapon c = repo.GetById(4); Assert.IsNotNull(c, "Weapon wasn't correctly retrieved"); }
public ActionResult Delete(int id) { weaponRepository = new WeaponRepository(); var weapon = weaponRepository.GetById(id); return(View(weapon)); }