Exemple #1
0
        public void UpdateStyle(UpdateReportStyle report)
        {
            var origReport = _reportRepository.Get(report.ReportGUID);

            if (origReport == null)
            {
                throw new NotFoundException("Invalid reportGUID.");
            }

            origReport.Style = report.Style;

            _reportRepository.Update(origReport);
        }
        public IActionResult UpdateStyle([FromBody] UpdateReportStyle report)
        {
            try
            {
                if (report == null)
                {
                    throw new BasicException("Invalid input format!");
                }
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                _manager.UpdateStyle(report);
                return(Ok());
            }
            catch (BasicException ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest(ex.Message));
            }
            catch (NotFoundException ex)
            {
                _logger.LogError(ex.Message);
                return(NotFound(ex.Message));
            }
            catch (PermissionException ex)
            {
                _logger.LogError(ex.Message);
                return(Unauthorized());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }