Пример #1
0
        public async Task <IActionResult> DeleteAsync(int Id)
        {
            _logger.LogInformation("Delete script with ID : {scriptid}", Id);

            try
            {
                await _scriptService.DeleteAsync(Id);

                _logger.LogInformation("Script deleted");
                return(Ok());
            }
            catch (AppException ex)
            {
                _logger.LogError(ex, "Failed to delete script");
                return(BadRequest(new { message = "Failed to delete script" }));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Fatal failure");
                return(StatusCode(StatusCodes.Status500InternalServerError, new { message = "Fatal internal error. Please contact administrator" }));
            }
        }