Exemplo n.º 1
0
        public void ConvertDatepickerUnprocessableExceptionTest()
        {
            var testDatepickerConversion = new TestDatepickerConversion().DatePickerConversionNoDates;
            var testUser = new TestUser().User;

            Assert.ThrowsAsync <UnprocessableException>(() => _datepickerLogic.ConvertDatepicker(testDatepickerConversion, testUser));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Convert([FromBody] DatePickerConversion datepickerConverter)
        {
            try
            {
                UserHelper requestingUser = _controllerHelper.GetRequestingUser(this);
                await _datepickerLogic.ConvertDatepicker(datepickerConverter, requestingUser);

                return(Ok());
            }
            catch (UnauthorizedAccessException)
            {
                return(Unauthorized());
            }
            catch (UnprocessableException)
            {
                return(UnprocessableEntity());
            }
            catch (NoNullAllowedException)
            {
                return(StatusCode(StatusCodes.Status304NotModified));
            }
            catch (Exception e)
            {
                _logLogic.Log(e);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }