Beispiel #1
0
 public ActionResult <CommandReadDto> GetCommandById(int id)
 {
     if (_repository.GetCommandById(id) != null)
     {
         return(Ok(_mapper.Map <CommandReadDto>(_repository.GetCommandById(id))));
     }
     return(NotFound());
 }
Beispiel #2
0
 public ActionResult <CommandReadDto> GetCommandById(int id)
 {
     var item = _repository.GetCommandById(id);
     if(item != null)
     {
         return Ok(_mapper.Map<CommandReadDto>(item));
     }
     return NotFound();
 }
Beispiel #3
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandData = _repository.GetCommandById(id);

            if (commandData != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandData)));
            }
            return(NotFound());
        }
Beispiel #4
0
        public ActionResult <CommandReadDTO> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

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

            if (command != null)
            {
                return(Ok(_mapper.Map <CommandReadDtos>(command)));
            }
            return(NotFound());
        }
Beispiel #6
0
        public async Task <ActionResult <CommandReadDto> > GetCommandById(int id, CancellationToken cancellationToken)
        {
            var result = await _repository.GetCommandById(id, cancellationToken).ConfigureAwait(false);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <CommandReadDto>(result)));
        }
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);       //Domain Model Command

            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem))); //Swap Domain Model for DTO command
            }
            return(NotFound());                                        //404 status code
        }
Beispiel #8
0
        public ActionResult <CommandReadDto> GetCommandById(int Id)
        {
            var commandItem = _repository.GetCommandById(Id);

            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }
            return(NotFound());//return 404 NOT FOUND
        }
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _commanderRepo.GetCommandById(id);

            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }
            return(NotFound());
        }
Beispiel #10
0
        [HttpGet("{id}", Name = "GetCommandById")]         // indique que cette méthode répond à une requete http
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem))); // map commandItem en CommandReadDto pour renvoyer les données formattées au client
            }
            return(NotFound());                                        // si pas trouvé renvoie 404 not found
        }
Beispiel #11
0
        public ActionResult <Command> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                return(Ok(commandItem));
            }
            return(NotFound());
        }
Beispiel #12
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem))); // correct return of dto without platform
            }
            return(NotFound());                                        // get 404 not found from postman
        }
Beispiel #13
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var singleCommandItem = _repos.GetCommandById(id);

            if (singleCommandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(singleCommandItem)));
            }
            return(NotFound());
        }
Beispiel #14
0
      [HttpGet("{id}", Name = "GetCommandById")] public ActionResult <CommandReadDto> GetCommandById(int id)
      {
          var comd = _repo.GetCommandById(id);

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

            if (commandItem is null)
            {
                return(NotFound());                                // 404 No command was found
            }
            return(Ok(_mapper.Map <CommandReadDto>(commandItem))); // Return OK 200 success
        }
 public ActionResult<CommandReadDto> GetCommandById(int id)    //The id comming from binding sources from [FromQuery]
 {
     var command = _repository.GetCommandById(id);
     if (command != null)
     {
         var model = _mapper.Map<CommandReadDto>(command);
         return Ok(model);
     }
     return NotFound();  //Instead of NoContent()
 }
Beispiel #17
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                // Palautetaan Models-luokan Command DTO-objekti
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }
            return(NotFound());
        }
Beispiel #18
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {   // acel id dat ca parametru vine din request(derivat direct din URI)
            // variabila ce retine doar comanda cu id-ul dat
            var commandItem = _repository.GetCommandById(id);

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

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

            if (commandItem != null)
            {
                //Map the commandItem into a CommandReadDto type
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }
            return(NotFound());
        }
        public ActionResult<CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);
            if (commandItem != null)
            {
                var dto = _mapper.Map<CommandReadDto>(commandItem);
                return Ok(dto);
            }

            return NotFound();
        }
        public ActionResult <CommandReadDto> GetCommandById(int id) // id comes from the request
        {
            var commandItem = _repository.GetCommandById(id);

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

            return(NotFound());
        }
Beispiel #23
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id); //variable contains our command item from our repository

            //This statement checks if the item id exists or not, if it doesnt exist, it will return a 404 Not Found
            if (commandItem != null)
            {
                return(Ok(_mapper.Map <CommandReadDto>(commandItem))); //returns data in our CommandReadDto format and returns a 200 OK
            }
            return(NotFound());                                        //returns 404 Not Found
        }
Beispiel #24
0
        public ActionResult <CommandReadDto> GetCommandbyId(string id)
        {
            var command = _repository.GetCommandById(id);

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

            return(Ok(_mapper.Map <CommandReadDto>(command)));
        }
        public ActionResult <CommandReadDto> GetCommandById([FromRoute] int id)
        {
            Command commandModel = _repo.GetCommandById(id);

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

            return(Ok(_mapper.Map <CommandReadDto>(commandModel)));
        }
Beispiel #26
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var command = _Repository.GetCommandById(id);

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

            return(NotFound($"No command found with id {id}"));
        }
Beispiel #27
0
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = commanderRepo.GetCommandById(id);

            if (commandItem != null)
            {
                // mapping from `Command` to `CommandReadDto`
                return(Ok(mapper.Map <CommandReadDto>(commandItem)));
            }

            return(NotFound());
        }
Beispiel #28
0
        public ActionResult <CommandReadDTO> GetCommandById(int id)
        {
            var data = _command_repo.GetCommandById(id);

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


            return(Ok(_mapper.Map <CommandReadDTO>(data)));
        }
        public ActionResult <CommandReadDto> GetCommandById(int id)
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem == null)
            {
                return(NotFound());
            }
            //var commandItem = HttpContext.Items["entity"] as Command;

            return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
        }
        [HttpGet("{id}", Name = "GetCommandById")]                  //binding source   // Name="GetCommandById  == makes use of this method in another method??  has to be same name as method name
        public ActionResult <CommandReadDto> GetCommandById(int id) //change <Command> to CommandReadDto
        {
            var commandItem = _repository.GetCommandById(id);

            if (commandItem != null)
            {
                // return commandreaddto thats been mapped
                // mapping data from commandItem to a CommandReadDto
                return(Ok(_mapper.Map <CommandReadDto>(commandItem)));
            }
            return(NotFound());
        }