Esempio n. 1
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }
            return(NotFound());
        }
Esempio n. 2
0
        public ActionResult <CommandReadDto> GetById(int id)
        {
            var result = _repository.GetCommandById(id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <CommandReadDto>(result)));
        }
Esempio n. 3
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var item = repository.GetCommandById(id);

            if (item == null)
            {
                return(NotFound());
            }

            return(Ok(this.mapper.Map <CommandReadDto>(item)));
        }
Esempio n. 4
0
        public ActionResult <CommandReadDTO> GetCommandById(int id)
        {
            var command = _repo.GetCommandById(id);

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

            return(Ok(_mapper.Map <CommandReadDTO>(command)));
        }
Esempio n. 5
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandById = _commanderRepository.GetCommandById(id);

            if (commandById != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandById)));
            }

            return(NotFound("Command not found"));
        }
        public ActionResult <CommandReadDto> GetCommand(int id)
        {
            var command = _respository.GetCommandById(id);

            BackgroundJob.Enqueue(() => _respository.DeleteCommand(command));

            if (command != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(command)));
            }
            return(NotFound());
        }
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                // Return a mapped Dto, not the object returned by the db query
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }

            return(NotFound());
        }
Esempio n. 8
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem == null)
            {
                return(NotFound());
            }

            // Mapping from Command model to a new empty CommandReadDto
            var mapping = _mapper.Map <CommandReadDto>(commandItem);

            return(Ok(mapping));
        }
Esempio n. 9
0
        public ActionResult <CommandDto> GetCommandById(int id)
        {
            var command = _commanderRepository.GetCommandById(id);

            if (command == null)
            {
                return(null);
            }
            return(new CommandDto
            {
                Id = command.Id,
                HowTo = command.HowTo,
                Line = command.Line
            });
        }
Esempio n. 10
0
        public ActionResult <Command> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            return(Ok(commandItem));
        }