Exemplo n.º 1
0
        public async Task <IActionResult> Remove([FromBody][Required] RemoveEventRequest request)
        {
            var input = new RemoveEventInput(request.EventId);
            await _useCase.Execute(input);

            return(_presenter.ViewModel);
        }
Exemplo n.º 2
0
        public async Task Execute(RemoveEventInput input)
        {
            if (input is null)
            {
                throw new Exception();
            }

            if (!await _repository.Exists(input.Id))
            {
                _output.Error("There is no event with this ID.");
                return;
            }

            var deletedEvent = await _repository.Remove(input.Id);

            _output.Default(new RemoveEventOutput(deletedEvent));
        }