public override void ExecuteResult(ControllerContext context) { IStateCommand[] commands = _facilitator.GetValidStateCommands(_expenseReport, _session.GetCurrentUser()); IStateCommand matchingCommand = Array.Find(commands, delegate(IStateCommand obj) { return(obj.Matches(_command)); }); matchingCommand.Execute(_visitor); context.Controller.TempData["Flash"] = _session.PopUserMessage(); }
public ExecuteTransitionResult Handle(ExecuteTransitionCommand command) { IStateCommand[] commands = new WorkflowFacilitator().GetValidStateCommands(command); IStateCommand matchingCommand = Array.Find(commands, delegate(IStateCommand obj) { return(obj.Matches(command.Command)); }); matchingCommand.Execute(command); _bus.Send(new ExpenseReportSaveCommand { ExpenseReport = command.Report }); _bus.Send(new AddExpenseReportFactCommand(new ExpenseReportFact(command.Report, command.CurrentDate))); return(new ExecuteTransitionResult { NewStatus = command.Report.Status.FriendlyName, NextStep = NextStep.Edit }); }
public void ExecuteCommand() { _command.Execute(); }