/// <inheritdoc />
    public Task <Unit> Handle(DeleteScenarioCommand request, CancellationToken cancellationToken)
    {
        if (!_scenarioService.DeleteScenario(request.ScenarioName))
        {
            throw new NotFoundException($"Scenario '{request.ScenarioName}' not found.");
        }

        return(Unit.Task);
    }
    /// <inheritdoc />
    public Task <StubResponseWriterResultModel> WriteToResponseAsync(StubModel stub, ResponseModel response)
    {
        if (stub.Response.Scenario?.ClearState != true || string.IsNullOrWhiteSpace(stub.Scenario))
        {
            return(Task.FromResult(StubResponseWriterResultModel.IsNotExecuted(GetType().Name)));
        }

        _scenarioService.DeleteScenario(stub.Scenario);
        return(Task.FromResult(StubResponseWriterResultModel.IsExecuted(GetType().Name)));
    }
Exemple #3
0
        public ActionResult Delete(int id)
        {
            var response = _scenarioService.DeleteScenario(new DeleteScenarioRequest {
                Id = id
            });

            TempData["IsSuccess"] = response.IsSuccess;
            TempData["Message"]   = response.Message;

            return(RedirectToAction("Index"));
        }