Example #1
0
        public async Task <ActionResult> Add([FromBody] Datepicker datepicker)
        {
            try
            {
                var        datepickerDto  = _mapper.Map <DatepickerDto>(datepicker);
                UserHelper requestingUser = _controllerHelper.GetRequestingUser(this);
                await _datepickerLogic.Add(datepickerDto, requestingUser);

                return(Ok());
            }
            catch (DuplicateNameException)
            {
                return(StatusCode(StatusCodes.Status409Conflict));
            }
            catch (Exception e)
            {
                _logLogic.Log(e);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Example #2
0
 public void AddUnprocessableExceptionTest()
 {
     Assert.ThrowsAsync <UnprocessableException>(() => _datepickerLogic.Add(new DatepickerDto(), new TestUser().User));
 }