Пример #1
0
        public ActionResult UpdateCommand(int Id, CommandUpdateDTO commandUpdateDTO)
        {
            var commandModalFromRepo = _repository.GetCommandById(Id);

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

            _mapper.Map(commandUpdateDTO, commandModalFromRepo);

            _repository.UpdateCommand(commandModalFromRepo);

            return(NoContent());
        }
        public ActionResult <CommandUpdateDto> UpdateCommand(int id, CommandUpdateDto commandUpdateDto)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                NotFound();
            }
            _mapper.Map(commandUpdateDto, commandModelFromRepo);

            _repository.UpdateCommand(commandModelFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }