public void DeleteCharge(int chargeId) { Charge dbCharge; dbCharge = Charges.Single(item => item.ChargeId == chargeId); Charges.Remove(dbCharge); }
public void DeleteCharge(Charge charge) { var oldCharge = Charges.Where(a => a.Id.Equals(charge.Id)).FirstOrDefault(); Charges.Remove(oldCharge); SaveChanges(); }
public void RemoveCharge(Unit defendingUnit, Unit chargingUnit) { List <Unit> unitsChargedByAttacker = Charges[chargingUnit]; unitsChargedByAttacker.Remove(defendingUnit); if (unitsChargedByAttacker.Count == 0) { chargingUnit.InConflict = false; Charges.Remove(chargingUnit); } CloneConflictDict(TempConflicts, Conflicts); RollInCharges(); if (ConflictDictConatinsUnit(defendingUnit, TempConflicts)) //checking conflitcs and charges seperately is probalby faster { return; //defending unit is not in tempconflict as a key or value } defendingUnit.InConflict = false; //couldn't be found in either tempconflict (which means they aren't in charges or conflits) }