public HttpResponseMessage Post([FromBody] CreateMovementConfirmationDto value) { try { if (value.DocumentNumber == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "MovementConfirmation"); } _movementConfirmationApplicationService.When(value as ICreateMovementConfirmation); var idObj = value.DocumentNumber; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = MovementConfirmationsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateMovementConfirmationDto c) { var idObj = (c as ICreateMovementConfirmation).DocumentNumber; var uriParameters = new MovementConfirmationUriParameters(); uriParameters.Id = idObj; var req = new MovementConfirmationPutRequest(uriParameters, (CreateMovementConfirmationDto)c); var resp = await _ramlClient.MovementConfirmation.Put(req); MovementConfirmationProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateMovementConfirmationDto c) { WhenAsync(c).GetAwaiter().GetResult(); }