public ActionResult DeleteCommand(int id) { var commandModelFromRepo = _repository.GetCommandById(id); if (commandModelFromRepo == null) { return(NotFound()); } _repository.DeleteCommand(commandModelFromRepo); _repository.SaveChanges(); return(NoContent()); }
public ActionResult DeleteById(int id) { var cmdToDelete = _getCommandByIdFromRepo(id); if (cmdToDelete == null) { return(NotFound()); } _repo.DeleteCommand(cmdToDelete); _repo.SaveChanges(); return(NoContent()); }
public ActionResult DeleteCommand(int id) { var modelCommand = _repository.GetCommandById(id); if (modelCommand == null) { return(NotFound()); } _repository.DeleteCommand(modelCommand); _repository.SaveChanges(); return(NoContent()); }
public ActionResult DeleteCommand(int id) { var cmd = repo.GetCommandById(id); if (cmd == null) { return(NotFound()); } repo.DeleteCommand(cmd); repo.SaveChanges(); return(NoContent()); }
public ActionResult DeleteCommand(int id) { var commandModelFromRepo = _commandAPIRepo.GetCommandById(id); if (commandModelFromRepo == null) { _logger?.LogWarn("command not found"); return(NotFound()); } _commandAPIRepo.DeleteCommand(commandModelFromRepo); _commandAPIRepo.SaveChanges(); return(NoContent()); }
public ActionResult DeleteCommand(int id) { Debug.WriteLine($"CommandsController::DeleteCommand({id})"); var commandModelFromRepo = _repository.GetCommandById(id); if (commandModelFromRepo == null) { return(NotFound()); } _repository.DeleteCommand(commandModelFromRepo); _repository.SaveChanges(); return(NoContent()); }
public async Task <ActionResult> DeleteCommand(int id) { var commmandToDelete = await Task.Run(() => _commandAPIRepo.GetCommandById(id)); if (commmandToDelete == null) { return(NotFound()); } await Task.Run(() => _commandAPIRepo.DeleteCommand(commmandToDelete)); // After muttation, we need to save changes to db await Task.Run(() => _commandAPIRepo.SaveChanges()); return(NoContent()); }
public ActionResult <string> deleteCommand(int id) { var commandItem = _repository.DeleteCommand(id); return(commandItem); }