Пример #1
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

            _repository.DeleteCommand(commandModelFromRepo);
            return(NoContent());
        }
Пример #2
0
 public ActionResult <string> DeleteCommand(int id)
 {
     _repository.DeleteCommand(id);
     if (_repository.SaveChanges())
     {
         return("Delete Success!");
     }
     return(new NotFoundResult());
 }
Пример #3
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = ReturnCommandIsValueNotNull(id).Value;

            _repository.DeleteCommand(commandModelFromRepo);

            _repository.SaveChanges();

            return(NoContent());
        }
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges();
            return(NoContent());
        }
        public ActionResult DeleteCommand(int id)
        {
            var objCommandItem = _reporsitory.GetCommandById(id);

            if (objCommandItem == null)
            {
                return(NotFound());
            }
            _reporsitory.DeleteCommand(objCommandItem);
            _reporsitory.SaveChanges();
            return(NoContent());
        }
Пример #6
0
        public ActionResult CommandDelete(int id)
        {
            var cmdFromRepo = _repo.GetCommandById(id);

            if (cmdFromRepo == null)
            {
                return(NotFound());
            }
            _repo.DeleteCommand(cmdFromRepo);
            _repo.SaveChanges();
            return(NoContent());
        }
Пример #7
0
        public ActionResult <CommandReadDto> DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges();

            return(Ok(_mapper.Map <CommandReadDto>(commandModelFromRepo)));
        }
Пример #8
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repo.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            _repo.DeleteCommand(commandModelFromRepo);
            _repo.SaveChanges();

            return(Ok("deleted Key"));
        }
Пример #9
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);             // cherche l'objet dans la bdd

            if (commandModelFromRepo == null)
            {
                return(NotFound());                          // si il n'existe pas on quitte et envoie 404
            }
            _repository.DeleteCommand(commandModelFromRepo); // supprime l'id dans l'objet
            _repository.SaveChanges();                       // sauvegarde dans la bdd

            return(NoContent());
        }
Пример #10
0
        public ActionResult DeleteCommand(int id)
        {
            var commandItem = _commanderRepo.GetCommandById(id);

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

            _commanderRepo.DeleteCommand(commandItem);
            _commanderRepo.SaveChanges();
            return(NoContent());
        }
        public ActionResult DeleteCommand(int id)
        {
            var httpCommand = _repository.GetCommandById(id);

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

            _repository.DeleteCommand(httpCommand);
            _repository.SaveChanges();
            return(NoContent());
        }
Пример #12
0
        public ActionResult deleteCommand(int id)
        {
            var cmdObj = _repoObj.getCommandById(id);

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

            _repoObj.DeleteCommand(cmdObj);
            _repoObj.saveChanges();
            return(NoContent());
        }
        public ActionResult DeleteCommand(int id)
        {
            var commandFromRepo = _repoistory.GetCommandById(id);

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

            _repoistory.DeleteCommand(commandFromRepo);

            return(NoContent());
        }
Пример #14
0
        public ActionResult DeleteCommand(int id)
        {
            // Loads the model with info from the database
            var commandModelFromRepo = _repository.GetCommandById(id);

            // validates there was something for the id number
            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges();
            return(NoContent());
        }
        public ActionResult DeleteCommandById([FromRoute] int id)
        {
            Command commandModel = _repo.GetCommandById(id);

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

            _repo.DeleteCommand(commandModel);
            _repo.SaveChanges();

            return(NoContent());
        }
Пример #16
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                return(NotFound()); //returns 404 not found if command does not exist (null)
            }

            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges(); //this makes sure that the command created gets saved in our database

            return(NoContent());       //returns 204 response
        }
Пример #17
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _Repository.GetCommandById(id);

            if (commandModelFromRepo is null)
            {
                return(NotFound($"No command found with id {id}"));
            }

            _Repository.DeleteCommand(commandModelFromRepo);
            _Repository.SaveChanges();

            return(NoContent());
        }
Пример #18
0
        public ActionResult DeleteCommand(int id)
        {
            var existing = Repository.GetCommandById(id);

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

            Repository.DeleteCommand(existing);
            Repository.SaveChanges();

            return(NoContent());
        }
Пример #19
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromService = _commanderService.GetCommandById(id);

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

            _commanderService.DeleteCommand(commandModelFromService);
            _commanderService.SaveChanges();

            return(NoContent());
        }
Пример #20
0
        public ActionResult DeleteCommand(int id)
        {
            var command = _repo.GetCommandById(id);

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

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

            return(NoContent());
        }
Пример #21
0
        public ActionResult DeleteCommand(int id)
        {
            // Checked if object exists.
            var commandModelFromRepo = _repository.GetCommandById(id);

            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            // Object deleted and changes saved.
            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges();
            return(NoContent());
        }
Пример #22
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

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

            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges();

            return(AcceptedAtRoute(nameof(DeleteCommand), new { Id = id }, commandModelFromRepo));
        }
Пример #23
0
        public ActionResult DeleteCommand(int id)
        {
            var commandModelFromRepo = _repository.GetCommandById(id);

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

            _repository.DeleteCommand(commandModelFromRepo);

            _repository.SaveChanges(); // Always rememeber to add SaveChanges() to controller

            return(NoContent());
        }
        public ActionResult <CommandReadDto> DeleteCommand(int id)
        {
            var commandModel = _repo.GetCommandById(id);

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

            _repo.DeleteCommand(commandModel);

            _repo.saveChanges();

            return(NoContent());
        }
Пример #25
0
        public ActionResult <DeleteDto> DeleteCommand(int id)
        {
            var commandExists = _repository.GetCommandById(id);

            if (commandExists == null)
            {
                return(NotFound());
            }
            _repository.DeleteCommand(id);
            _repository.SaveChanges();

            return(Ok(new DeleteDto {
                Status = 200, Message = "The result has been deleted"
            }));
        }
Пример #26
0
        public ActionResult DeleteCommand(int id)
        {
            // check that the resource to be updated exist
            var commandModelFromRepo = _repository.GetCommandById(id);

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

            _repository.DeleteCommand(commandModelFromRepo);
            _repository.saveChanges();

            return(NoContent());
        }
Пример #27
0
        public ActionResult deleteCommand(int id)
        {
            Command commandFromRepo = _repository.GetCommandByID(id);

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

            _repository.DeleteCommand(commandFromRepo);

            _repository.saveChanges();

            return(NoContent());
        }
        public ActionResult DeeleteCommand(int id)
        {
            //comprobamos si el recurso existe o no
            var commandModelFromRepo = _repository.GetCommandById(id);

            //comprobamos si es nulo
            if (commandModelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteCommand(commandModelFromRepo);
            _repository.SaveChanges();

            return(NoContent());
        }
Пример #29
0
        public ActionResult DeleteCommand(int id)
        {
            // Check resource exists
            var commandModelFromRepo = _repo.GetCommandById(id);

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

            // Delete command
            _repo.DeleteCommand(commandModelFromRepo);
            _repo.SaveChanges();

            return(NoContent());
        }
Пример #30
0
        public ActionResult DeleteCommand(int id)
        {
            var repoCommandModel = _repository.GetCommandById(id);

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

            _repository.DeleteCommand(repoCommandModel);
            if (_repository.SaveChanges())
            {
                return(NoContent());
            }

            return(StatusCode(500));
        }