protected async Task <IActionResult> InternalDelete(string id) { _logger.LogInformation(string.Format(Global.DeleteResource, id)); try { var representation = await _deleteRepresentationCommandHandler.Handle(new DeleteRepresentationCommand(id, _resourceType, Request.GetAbsoluteUriWithVirtualPath())); if (SCIMConstants.MappingScimResourceTypeToCommonType.ContainsKey(_resourceType)) { await _busControl.Publish(new RepresentationRemovedEvent(id, representation.Version, SCIMConstants.MappingScimResourceTypeToCommonType[_resourceType], _options.IncludeToken ? Request.GetToken() : string.Empty)); } return(new StatusCodeResult((int)HttpStatusCode.NoContent)); } catch (SCIMNotFoundException ex) { _logger.LogError(ex, ex.Message); return(this.BuildError(HttpStatusCode.NotFound, ex.Message, SCIMConstants.ErrorSCIMTypes.Unknown)); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(this.BuildError(HttpStatusCode.InternalServerError, ex.ToString(), SCIMConstants.ErrorSCIMTypes.InternalServerError)); } }
private async Task <IActionResult> InternalDelete(string id) { try { await _deleteRepresentationCommandHandler.Handle(new DeleteRepresentationCommand(id, _scimEndpoint)); return(new StatusCodeResult((int)HttpStatusCode.NoContent)); } catch (SCIMNotFoundException) { return(this.BuildError(HttpStatusCode.NotFound, $"Resource {id} not found.")); } }
private async Task <IActionResult> InternalDelete(string id) { _logger.LogInformation(string.Format(Global.DeleteResource, id)); try { await _deleteRepresentationCommandHandler.Handle(new DeleteRepresentationCommand(id, _resourceType)); return(new StatusCodeResult((int)HttpStatusCode.NoContent)); } catch (SCIMNotFoundException ex) { _logger.LogError(ex, ex.Message); return(this.BuildError(HttpStatusCode.NotFound, ex.Message, SCIMConstants.ErrorSCIMTypes.Unknown)); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(this.BuildError(HttpStatusCode.InternalServerError, ex.ToString(), SCIMConstants.ErrorSCIMTypes.InternalServerError)); } }