Ejemplo n.º 1
0
        public async Task <ActionResult <CommandReadDto> > GetCommandById(int id)
        {
            Command command = await _repository.GetCommand(id);

            if (command == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <CommandReadDto>(command)));
        }
        public ActionResult <CommandReadDto> GetCommandForPlatform(int platformId, int commandId)
        {
            Console.WriteLine($"--> Hit {nameof(GetCommandForPlatform)}, {nameof(platformId)} : {platformId} / {nameof(commandId)} : {commandId}");
            if (!_repo.PlatformExists(platformId))
            {
                return(NotFound());
            }

            var command = _repo.GetCommand(platformId, commandId);

            if (command is null)
            {
                return(NotFound());
            }

            var commandReadDto = _mapper.Map <CommandReadDto>(command);

            return(Ok(commandReadDto));
        }