public void RepairTieFighters() { var tieFighters = _repository.GetDamagedTieFighters(); //OutOfRangeException because of less than equal to condition //removed equal to for fixing issue for (var i = 0; i < tieFighters.Count; i++) { tieFighters[i].IsDamaged = false; } // We can achieve the same with foreach loop with less possiblities for such error foreach (var tf in tieFighters) { tf.IsDamaged = false; } }
public IActionResult List() { var results = _tieFighterRepository.GetDamagedTieFighters(); return(Ok(results)); }