public async Task <IActionResult> DeleteApiScope([FromRoute] Guid id, [FromRoute] Guid scopeId) { var command = new DeleteApiScopeCommand { Id = scopeId, ApiResourceId = id }; await _mediator.Send(command); return(Ok()); }
public async Task <bool> Handle(DeleteApiScopeCommand message, CancellationToken cancellationToken) { var api = await _repository.GetById(message.ApiResourceId) ?? throw new KeyNotFoundException(); api.DeleteScope(message.Id); await _repository.SaveAsync(api); return(true); }
public async Task <IActionResult> DeleteApiScope(DeleteApiScopeCommand command) { try { var client = await _mediator.Send(command); return(Ok()); } catch (KeyNotFoundException ex) { return(NotFound()); } catch (ArgumentException argumentException) { return(BadRequest(argumentException.Message)); } }