public async Task <ActionResult> Update([FromBody] Datepicker datepicker) { try { var datepickerDto = _mapper.Map <DatepickerDto>(datepicker); await _datepickerLogic.Update(datepickerDto); return(Ok()); } catch (KeyNotFoundException) { return(NotFound()); } catch (UnprocessableException) { return(StatusCode(StatusCodes.Status422UnprocessableEntity)); } catch (DuplicateNameException) { return(StatusCode(StatusCodes.Status409Conflict)); } catch (Exception e) { _logLogic.Log(e); return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public void UpdateUnprocessableExceptionTest() { Assert.ThrowsAsync <UnprocessableException>(() => _datepickerLogic.Update(new DatepickerDto())); }