Ejemplo n.º 1
0
        public async Task <ActionResult <CyborgViewModel> > Get(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var cyborg = await _cyborgService.GetCyborg(id);

            if (cyborg == null)
            {
                return(NotFound());
            }
            return(Ok(new CyborgViewModel(await _cyborgService.GetCyborg(id))));
        }
Ejemplo n.º 2
0
        private async Task <ICanPerformErrand> DeactivateRandomCyborg(ICanPerformErrand actor)
        {
            var targettedActors = await _cyborgService.GetCyborgsBy(string.Empty, null);

            var randomSkipCount   = _randomGenerator.Next(1, targettedActors.Count());
            var actorToDeactivate = await _cyborgService.GetCyborg(randomSkipCount);

            if (actorToDeactivate != null)
            {
                actorToDeactivate.IsActive   = false;
                actorToDeactivate.KilledById = actor.Id;
                return(actorToDeactivate);
            }
            else
            {
                return(null);
            }
        }