예제 #1
0
        public async Task <IActionResult> DeleteNode([FromBody] DeleteContactDTO contactDTO)
        {
            try
            {
                await _contactService.Delete(contactDTO);
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
            catch (System.Exception ex)
            {
                return(BadRequest(ErrorDTO.Create(ex.Message)));
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> UpdateNode([FromBody] UpdatePageDTO pageDTO)
        {
            try
            {
                await _pageService.Update(pageDTO);

                return(NoContent());
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
            catch (System.Exception ex)
            {
                return(BadRequest(ErrorDTO.Create(ex.Message)));
            }
        }
예제 #3
0
 /**********************************************************************************/
 /// <summary>
 /// returns error to hub
 /// </summary>
 protected void Error(string errorMessage = null, ActivityErrorCode?errorCode = null)
 {
     SetResponse(ActivityResponse.Error);
     OperationalState.CurrentActivityResponse.AddErrorDTO(ErrorDTO.Create(errorMessage, ErrorType.Generic, errorCode.ToString(), null, null, null));
 }
 /**********************************************************************************/
 /// <summary>
 /// returns error to hub
 /// </summary>
 /// <param name="errorCode"></param>
 /// <param name="currentActivity">Activity where the error occured</param>
 /// <param name="currentTerminal">Terminal where the error occured</param>
 /// <param name="errorMessage"></param>
 /// <param name="errorType"></param>
 /// <returns></returns>
 protected void RaiseError(string errorMessage, ErrorType errorType, ActivityErrorCode?errorCode = null, string currentActivity = null, string currentTerminal = null)
 {
     OperationalState.CurrentActivityErrorCode = errorCode;
     OperationalState.CurrentActivityResponse  = ActivityResponseDTO.Create(ActivityResponse.Error);
     OperationalState.CurrentActivityResponse.AddErrorDTO(ErrorDTO.Create(errorMessage, errorType, errorCode.ToString(), null, currentActivity, currentTerminal));
 }
 /**********************************************************************************/
 /// <summary>
 /// returns error to hub
 /// </summary>
 /// <param name="errorCode"></param>
 /// <param name="currentActivity">Activity where the error occured</param>
 /// <param name="currentTerminal">Terminal where the error occured</param>
 /// <param name="errorMessage"></param>
 /// <param name="errorType"></param>
 /// <returns></returns>
 protected void RaiseError(string errorMessage, ActivityErrorCode?errorCode = null, ErrorType errorType = ErrorType.Generic)
 {
     SetResponse(ActivityResponse.Error);
     OperationalState.CurrentActivityResponse.AddErrorDTO(ErrorDTO.Create(errorMessage, errorType, errorCode.ToString(), null, MyTemplate.Name, MyTemplate.Terminal?.Name));
 }