private void RefreshCommands() { AddNoteCommand.RaiseCanExecuteChanged(); MoveUpCommand.RaiseCanExecuteChanged(); MoveDownCommand.RaiseCanExecuteChanged(); DeleteNodeCommand.RaiseCanExecuteChanged(); }
public ICommandResult Handle(DeleteNodeCommand command) { //Fail Fast Validation command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, Messages.Ex_ExceptionGeneric, command.Notifications)); } var node = _repository.GetById(command.Id); if (node == null) { return(new GenericCommandResult(false, Messages.Ex_ItemNotFound.ToFormat(command.Id.ToString() ?? ""), command.Notifications)); } _repository.Delete(node); return(new GenericCommandResult(true, Messages.Act_Deleted, node)); }
public ActionResult Delete(int groupId, int nodeId) { Request.ThrowIfDifferentReferrer(); var node = _database.Nodes .SingleOrDefault(n => n.GroupId == groupId && n.Id == nodeId); if (node != null) { var command = new DeleteNodeCommand() { Node = node }; _dispatcher.Dispatch(command); return(RedirectToAction(nameof(Index))); } return(HttpNotFound()); }
public GenericCommandResult Delete([FromBody] DeleteNodeCommand command, [FromServices] NodeHandler handler) { return((GenericCommandResult)handler.Handle(command)); }
/// <summary> /// Removes the given node from the graph /// </summary> /// <param name="graph"></param> /// <param name="node"></param> public static void DeleteNode(this StateMachine stateMachine, Node node) { ICommand command = new DeleteNodeCommand(stateMachine, node); command.Execute(); }