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());
        }
Exemplo n.º 2
0
        public ActionResult DeleteCommand(int id)
        {
            Command commandModelFromRepo = repository.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            repository.DeleteCommand(commandModelFromRepo);
            repository.SaveChanges();
            return(NoContent());
        }
Exemplo n.º 3
0
        public IActionResult DeleteCommand(int id)
        {
            var commandItem = Repository.GetCommandBy(id);

            if (commandItem == null)
            {
                return(NotFound());
            }
            Repository.DeleteCommand(commandItem);
            Repository.SaveChanges();
            return(NoContent());
        }
Exemplo n.º 4
0
        public ActionResult DeleteCommand(int id)
        {
            var commandFromRepo = _repository.GetCommand(id);

            if (commandFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteCommand(commandFromRepo);
            _repository.SaveChanges();
            return(NoContent());
        }
        public ActionResult DeleteCommand(int id)
        {
            var command = _respository.GetById(id);

            if (command == null)
            {
                return(NotFound()); // 404
            }
            _respository.DeleteCommand(command);

            return(NoContent());
        }
Exemplo n.º 6
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModel = repository.GetCommandById(id);

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

            repository.DeleteCommand(commandModel);

            return(NoContent());
        }
Exemplo n.º 7
0
        public ActionResult DeleteCommand(int id)
        {
            var command = _repo.GetCommandById(id);

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

            _repo.DeleteCommand(command);
            _repo.SaveChanges();

            return(NoContent());
        }
Exemplo n.º 8
0
        public ActionResult DeleteCommand(int id)
        {
            // Check to see if the model already exists. If not, return NotFound
            var commandModelFromRepository = _repository.GetCommandById(id);

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

            // If it does exist, delete the command from context and save to the db
            _repository.DeleteCommand(commandModelFromRepository);
            _repository.SaveChanges();

            // Once done, return a 204 to indicate the resource has been deleted
            return(NoContent());
        }