示例#1
0
        public async Task Delete(int ID)
        {
            var weapon = _weaponRepository.GetById(ID);

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

            // Delete and save
            _weaponRepository.Delete(weapon);
            await _weaponRepository.SaveChanges();
        }
示例#2
0
 public ActionResult Delete(Weapon weapon)
 {
     weaponRepository = new WeaponRepository();
     weaponRepository.Delete(weapon.ID);
     return(RedirectToAction("Weapons"));
 }