コード例 #1
0
        public async Task <ActionResult> DeleteAsync([FromRoute] Guid id)
        {
            try
            {
                await _tenantRepository.DeleteByIdAsync(id);

                await _tenantRepository.SaveAsync();

                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (ArgumentException)
            {
                _logger.LogWarning("DELETE request failed. Not Found Exception");
                return(NotFound());
            }
            catch (InvalidOperationException e)
            {
                _logger.LogError("DELETE request failed. Error: " + e.Message);
                return(Conflict(e.Message));
            }
            catch (Exception e)
            {
                _logger.LogError("DELETE request failed. Error: " + e.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }