Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        public IActionResult List()
        {
            var results = _tieFighterRepository.GetDamagedTieFighters();

            return(Ok(results));
        }